dillon1000/react

Commit

TryStatement: optimization pass, handle early returns

Adds an optimization pass to prune unnecessary maybe-throw terminals, when the 
block can be proven not to throw. For now we're _very_ conservative about what 
instructions we consider not to throw. There isn't too much of an advantage in 
pruning further, either. 

This PR also updates BuildReactiveFunction to handle the possibility of early 
returns within try or catch blocks, making sure we don't hit the invariant of 
emitting the same block twice.
Browse files
Changed paths9 files
First-parent comparison
M compiler/packages/babel-plugin-react-forget/src/Entrypoint/Pipeline.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/HIR/HIR.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/Optimization/PruneMaybeThrows.ts AddedM compiler/packages/babel-plugin-react-forget/src/Optimization/index.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/BuildReactiveFunction.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-return.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-return.js AddedM compiler/packages/sprout/src/SproutTodoFilter.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…