mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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:
+5
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user