dillon1000/react
Commit
Browse files [be] Limit scope of temporaries in codegen
This morning @mofeiZ reminded me that our codegen doesn't really have any guards against reordering, since temporaries are lazily emitted. We're relying on the fact that our lowering and memoization carefully preserves order of evaluation, such that delaying the instructions in codegen doesn't change semantics. To help catch any mistakes with this, I had previously added code that reset the codegen context's temporaries before/after exiting a reactive scope. That ensured that temporaries from within the scope weren't accessible outside it. This PR extends that approach to _all_ blocks, so that temporaries created within a block aren't accessible outside it. I'm also going to explore more actively resetting temporaries after they "should" be used. There are a couple cases where temporaries are reused, though, which we have to change first.
Changed paths1 file
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…