Move creation of scopes for primitives into a separate pass
Rather than force scopes to be created for primitives within InferReactiveScopeVariables, here we move the creation of scopes for these instructions to a later pass. Later in the pipeline we have more context, such as whether e.g. a primitive or propertyload is being accessed within a scope or not, and whether it therefore needs its own scope or not.
Joe Savona committed
Feb 27, 2024 at 12:01 UTC
9d5a01359faf1652eda92952aa6e40d2e61968e1
1 file changed
+2
-4
compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts
+2
-4
@@ -154,13 +154,11 @@ function mayAllocate(env: Environment, instruction: Instruction): boolean {
154
case "NextIterableOf":
155
case "NextPropertyOf":
156
case "Debugger":
157
- case "Memoize": {
158
- return false;
159
- }
157
+ case "Memoize":
158
case "UnaryExpression":
159
case "BinaryExpression":
160
case "PropertyLoad": {
163
- return env.config.enableForest;
161
+ return false;
162
}
163
case "CallExpression":
164
case "MethodCall": {