dillon1000/react

Commit

Fix bug with scope output analysis for nested scopes

When collecting the output of each scope I was checking to see whether each 
operand was being used after the end of the _current_ scope. What we really want 
to be checking is whether the operand is used after _the scope in which it's 
defined_. Those are the same thing when there is no nesting, involved, so the 
previous logic worked for most examples. 

It isn't super easy to tell when if the operand's scope has ended, because we 
don't always know what the "current" InstructionId is inside a ReactiveFunction. 
And that in turn isn't quite so easy to change, because of some edge cases like 
break statements that we synthesize. The solution here is to track the set of 
active scopes, and if an operand is used and its scope is not active then voila, 
it's scope must have completed and its an output.
Browse files
Changed paths12 files
First-parent comparison
M compiler/forget/src/ReactiveScopes/PropagateScopeDependencies.ts ModifiedM compiler/forget/src/__tests__/fixtures/hir/_bug_independently-memoize-object-property.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/component.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md Modified
Patch

Files changed

Rendering syntax-highlighted changes…