You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cfg): append switch case condition to correct block (#14810)
When a switch case test contains a logical expression (|| or &&), visiting the expression creates multiple CFG blocks for short-circuit evaluation and changes current_node_ix. The condition instruction must be appended to the block BEFORE visiting the expression, not after.
This matches the pattern used in visit_if_statement and ensures the condition instruction is placed in the case entry block, making it discoverable by code that identifies case test blocks.
Before:
```rust
self.visit_expression(expr); // moves current_node_ix
cfg.append_condition_to(cfg.current_node_ix, ...); // wrong block
After:
let condition_block_ix = cfg.current_node_ix; // save before
self.visit_expression(expr);
cfg.append_condition_to(condition_block_ix, ...); // correct block
0 commit comments