dillon1000/react

Commit

[valueblocks] Join blocks instead of replacing operands (fix edge case)

There's a bug in the HIR->ReactiveFunction conversion for certain categories of 
compound value blocks where we replace operands (which must be a Place) with a 
ReactiveValue. This approach worked in practice for lots of cases so I thought a 
type coercion was safe, but then I found a case where this assumption breaks 
(see new test). 

The updated logic fixes the bug and is simpler. When a value block gets split up 
(because there was a nested value block), instead of replacing the earlier value 
in the later instructions, we append the instructions together. This can result 
in some extra nesting (which if we wanted we could flatten away) but ensures 
that we maintain type-safety.
Browse files
Changed paths4 files
First-parent comparison
M compiler/forget/src/ReactiveScopes/BuildReactiveFunction.ts ModifiedM compiler/forget/src/ReactiveScopes/PrintReactiveFunction.ts ModifiedA compiler/forget/src/__tests__/fixtures/hir/for-logical.expect.md AddedM compiler/forget/src/__tests__/fixtures/hir/for-logical.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…