@samitouri / QOS-React / commits / 5c9614785c

[codegen] Create new temporary map when entering reactive scopes

During codegen, when we now cache and restore the temporary values map as we enter and exit the scope. This ensures that any temporaries within the reactive scope are only visible within that scope, and not to subsequent code. In a subsequent PR this surfaces a bug with temporaries not correctly exported from a reactive scope.

Joe Savona committed Apr 20, 2023 at 16:48 UTC 5c9614785c35a60d5f25ce8dcb514e91608ede8e
1 file changed +2
compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts
+2
@@ -117,7 +117,9 @@ function codegenBlock(cx: Context, block: ReactiveBlock): t.BlockStatement {
117 break;
118 }
119 case "scope": {
120 + const temp = new Map(cx.temp);
121 codegenReactiveScope(cx, statements, item.scope, item.instructions);
122 + cx.temp = temp;
123 break;
124 }
125 case "terminal": {