dillon1000/react
Commit
Browse files Throw CompilerError (todo) for unused conditional/logical
If a logical or conditional expression is unused, then a phi node isn't created for the identifier it assigns to. Then when we leave SSA form the two branches will assign to separate values, and we aren't sure which identifier to use as the lvalue of the resulting ReactiveInstruction (remember that logicals/conditionals decompose into control flow in HIR, but are a single compound instruction in ReactiveFunction). If the two sides don't assign to the same location, it could be because of a bug in the compiler or because the value wasn't used. Ideally we'd represent this explicitly, but for now i'm just making this a TODO since most logicals/conditionals should have their value used.
Changed paths6 files
First-parent comparisoncompiler/forget/src/CompilerError.ts ModifiedM compiler/forget/src/ReactiveScopes/BuildReactiveFunction.ts ModifiedA compiler/forget/src/__tests__/fixtures/compiler/error.todo-unused-conditional.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/error.todo-unused-conditional.js AddedA compiler/forget/src/__tests__/fixtures/compiler/error.todo-unused-logical.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/error.todo-unused-logical.js AddedPatch
Files changed
Rendering syntax-highlighted changes…