dillon1000/react

Commit

[deps] Add DeclareLocal to ReactiveScope decls

--- 

Try to fix bug from #1589: 

> If a declaration for an immutable identifier (i.e. one that is not later 
re-assigned, since undefined is a primitive) is sandwiched between mutations, we 
currently do not record it as an output or hoist it out of the reactive scope. 

One simple fix is to add all declared (and later referenced) identifiers as 
declarations of a reactive scope. This has some undesired effects (e.g. 
additional instructions + memo cache slots), but in practice, this shouldn't be 
happening often. 

Alternatively, we could 1.) add a pass to hoist declarations, 2.) account for 
this in constant propagation, or 3.) add a bailout
Browse files
Changed paths3 files
First-parent comparison
M compiler/forget/src/ReactiveScopes/PropagateScopeDependencies.ts ModifiedR compiler/forget/src/__tests__/fixtures/compiler/_bug.uninitialized-declaration-in-reactive-scope.expect.md →compiler/forget/src/__tests__/fixtures/compiler/uninitialized-declaration-in-reactive-scope.expect.md RenamedR compiler/forget/src/__tests__/fixtures/compiler/_bug.uninitialized-declaration-in-reactive-scope.js →compiler/forget/src/__tests__/fixtures/compiler/uninitialized-declaration-in-reactive-scope.js Renamed
Patch

Files changed

Rendering syntax-highlighted changes…