dillon1000/react
Commit
Browse files TryStatement: handle catch clause params
It's possible that the value thrown during a `try` block actually is a reference to some value defined outside the scope of the try block. If the catch clause param is also mutated, that means the mutable range of the variable would have to include the entire try/catch. We handle this by emitting a DeclareLocal temporary for the catch param prior to the try/catch. If it is modified during the catch block, that will extend its mutable range to cover the full try/catch. If any values are mutated inside the try, their range will also (naturally) extend around the full try/catch block. These ranges will overlap and be merged, ensuring that we capture the possibility that the value is mutated via the catch param. See unit test.
Changed paths9 files
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/HIR/HIR.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/HIR/PrintHIR.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/HIR/visitors.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/BuildReactiveFunction.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-catch-param.js AddedM compiler/packages/sprout/src/SproutTodoFilter.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…