mirror of
https://github.com/facebook/react.git
synced 2026-02-26 18:58:05 +00:00
52c6a34da30ffee665183df2aa8f97e3511fbd9e
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.
Description
Languages
JavaScript
67.9%
TypeScript
29.2%
HTML
1.5%
CSS
1.1%
CoffeeScript
0.2%
Other
0.1%