dillon1000/react

Commit

Phi operands belong in the same reactive scope

This completes the implementation of InferReactiveScopeVariables, adding support 
for phi nodes. Example: 

```javascript 

let x$0 = null; 

mutate(x$0); 

if (cond) { 

x$1 = a; 

mutate(x$1) 

} else { 

x$2 = b; 

} 

x$3 = phi(x$1, x$2); 

mutate(x$3); 

``` 

We now add x$1, x$2, and x$3 to the same reactive scope. This reflects the fact 
that x$3 cannot be computed without also computing both x$1 and x$2. Note that 
x$3 can never be x$0, so x$0 is _not_ added to the same scope. This allows us to 
take advantage of SSA form to note that _some_ instances of an identifier really 
are distinct.
Browse files
Changed paths19 files
First-parent comparison
M compiler/forget/src/HIR/InferReactiveScopeVariables.ts ModifiedM compiler/forget/src/__tests__/fixtures/hir/component.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/switch.expect.md Modified
Patch

Files changed

Rendering syntax-highlighted changes…