compiler: Represent pruned scopes instead of inlining

There are a few places where we want to check whether a value actually got memoized, and we currently have to infer this based on values that "should" have a scope and whether a corresponding scope actually exists. This PR adds a new ReactiveStatement variant to model a reactive scope block that was pruned for some reason, and updates all the passes that prune scopes to instead produce this new variant.

ghstack-source-id: aea6dab469
Pull Request resolved: https://github.com/facebook/react/pull/29781
This commit is contained in:
Joe Savona
2024-06-10 08:42:06 -07:00
parent a0e99f7a6d
commit aa0930452b
12 changed files with 113 additions and 6 deletions
@@ -400,6 +400,11 @@ function codegenBlockNoReset(
}
break;
}
case "pruned-scope": {
const scopeBlock = codegenBlockNoReset(cx, item.instructions);
statements.push(...scopeBlock.body);
break;
}
case "scope": {
const temp = new Map(cx.temp);
codegenReactiveScope(cx, statements, item.scope, item.instructions);