dillon1000/react
Commit
Browse files TryStatement: handle edge case control flows
Adds handling for some cases where the handler is unreachable (or is provably unreachable after analysis & optimization), where the try/catch can be flattened away: * The try block is empty. Nothing can throw, so the handler is unreachable. * The try block will always return. It can't return anything interesting (ie the result of a function call or variable load) since those could throw, but a try block that always return a primitive means the handler is unreachable. * The same, except where we only determine that the try block always returns via constant propagation.
Changed paths11 files
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/Entrypoint/Pipeline.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/HIR/HIRBuilder.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/HIR/index.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/Optimization/ConstantPropagation.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/Optimization/PruneMaybeThrows.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-empty-try.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-empty-try.js AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-immediately-returns.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-immediately-returns.js AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-immediately-throws-after-constant-propagation.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-immediately-throws-after-constant-propagation.js AddedPatch
Files changed
Rendering syntax-highlighted changes…