dillon1000/react

Commit

[be] Explicit todo diagnostics for hoisting

--- 

Currently, we error on non-hoisted identifiers in EnterSSA with a somewhat 
cryptic message. This PR changes `BuildHIR` hoisting logic to find ALL hoistable 
bindings, then error when we try to lower hoisting for unsupported declaration 
types. 

Two benefits to this refactoring: 

- Dedups "unhandled identifier declaration" logic (previous to #2552 and this 
PR, we did this check in three places). 

- More explicit todo diagnostic messages when we cannot hoist a declaration
Browse files
Changed paths6 files
First-parent comparison
M compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisted-function-declaration.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.hoisting-simple-function-declaration.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-captured-arg-separately.expect.md ModifiedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoist-function-decls.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoist-function-decls.js Added
Patch

Files changed

Rendering syntax-highlighted changes…