dillon1000/react

Commit

Support for with empty update expression

Adds support for `for` statements with an empty or unreachable update 
expression. In both cases, reversePostorderBlocks() will remove the 
empty/unreachable update block, leaving the ForTerminal.update pointing to a 
non-existent block. We explicitly rewrite this (much like we null out 
unreachable fallthroughs after shrink). When transforming to ReactiveFunction, 
we emit the update block as null if it was the same as the test block.
Browse files
Changed paths18 files
First-parent comparison
M compiler/forget/src/HIR/BuildHIR.ts ModifiedM compiler/forget/src/HIR/HIR.ts ModifiedM compiler/forget/src/HIR/HIRBuilder.ts ModifiedM compiler/forget/src/HIR/visitors.ts ModifiedM compiler/forget/src/Optimization/ConstantPropagation.ts ModifiedM compiler/forget/src/ReactiveScopes/BuildReactiveFunction.ts ModifiedM compiler/forget/src/SSA/LeaveSSA.ts ModifiedM compiler/forget/src/Utils/VisualizeHIRMermaid.ts ModifiedD compiler/forget/src/__tests__/fixtures/compiler/error.for-return.expect.md DeletedD compiler/forget/src/__tests__/fixtures/compiler/error.leave-ssa-handle-return-in-for.expect.md DeletedD compiler/forget/src/__tests__/fixtures/compiler/error.leave-ssa-handle-return-in-for.js DeletedM compiler/forget/src/__tests__/fixtures/compiler/error.todo-kitchensink.expect.md ModifiedA compiler/forget/src/__tests__/fixtures/compiler/for-empty-update-with-continue.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/for-empty-update-with-continue.js AddedA compiler/forget/src/__tests__/fixtures/compiler/for-empty-update.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/for-empty-update.js AddedA compiler/forget/src/__tests__/fixtures/compiler/for-return.expect.md AddedR compiler/forget/src/__tests__/fixtures/compiler/error.for-return.js →compiler/forget/src/__tests__/fixtures/compiler/for-return.js Renamed
Patch

Files changed

Rendering syntax-highlighted changes…