dillon1000/react

Commit

Fixtures demonstrating incorrect block scoping due to MergeConsecutiveBlocks

Fixtures from T173102122 and T173101739 demonstrating cases where 
MergeConsecutiveBlocks can move code out of its correct block scope, changing 
behavior or breaking the program, in cases where a control flow structure (such 
as switch) only has one non-returning control flow path. In these cases, the 
non-returning path gets merged with the fallthrough, effectively lifting that 
code out of the control flow structure and moving it into the outer scope. This 
can create dead code or just invalid code (with references to variables that are 
not in scope). 

Sprout fails on both of these fixtures: 

<img width="812" alt="Screenshot 2024-01-23 at 11 25 36 AM" 
src="https://github.com/facebook/react-forget/assets/6425824/d397ea22-3fa3-436e-b655-09a45781274b">
Browse files
Changed paths5 files
First-parent comparison
A compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/block-scoping-switch-dead-code.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/block-scoping-switch-dead-code.js AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/block-scoping-switch-variable-scoping.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/block-scoping-switch-variable-scoping.js AddedM compiler/packages/sprout/src/SproutTodoFilter.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…