dillon1000/react

Commit

Fix unused logical/condition via ExpressionStatement instr

Uses the new ExpressionStatement instruction to ensure that logical and 
conditional expressions are never pruned. This addresses an issue where we were 
unable to construct a ReactiveFunction for unused logical/conditional bc there 
wasn't a single Identifier assigned in both branches. The ExpressionStatement 
ensures that the result is used, that we don't prune the phi, and that both 
branches have a single assignment target. 

In theory we could be more sophisticated with DCE and still prune these 
instructions if their operands are also safe to prune, but in practice you're 
only like to have a logical/conditional as an expression statement (in the 
source) if it's for side effects.
Browse files
Changed paths6 files
First-parent comparison
M compiler/forget/src/HIR/BuildHIR.ts ModifiedD compiler/forget/src/__tests__/fixtures/compiler/error.todo-unused-conditional.expect.md DeletedA compiler/forget/src/__tests__/fixtures/compiler/unused-conditional.expect.md AddedR compiler/forget/src/__tests__/fixtures/compiler/error.todo-unused-conditional.js →compiler/forget/src/__tests__/fixtures/compiler/unused-conditional.js RenamedR compiler/forget/src/__tests__/fixtures/compiler/error.todo-unused-logical.expect.md →compiler/forget/src/__tests__/fixtures/compiler/unused-logical.expect.md RenamedR compiler/forget/src/__tests__/fixtures/compiler/error.todo-unused-logical.js →compiler/forget/src/__tests__/fixtures/compiler/unused-logical.js Renamed
Patch

Files changed

Rendering syntax-highlighted changes…