From 9d5a01359faf1652eda92952aa6e40d2e61968e1 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Tue, 27 Feb 2024 12:01:32 -0800 Subject: [PATCH] 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. --- .../src/ReactiveScopes/InferReactiveScopeVariables.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts index 436d3b48bf..0ff2638b31 100644 --- a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts +++ b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts @@ -154,13 +154,11 @@ function mayAllocate(env: Environment, instruction: Instruction): boolean { case "NextIterableOf": case "NextPropertyOf": case "Debugger": - case "Memoize": { - return false; - } + case "Memoize": case "UnaryExpression": case "BinaryExpression": case "PropertyLoad": { - return env.config.enableForest; + return false; } case "CallExpression": case "MethodCall": {