feat(minifier): fold switch stmt whose parent is not block stmt (#25403)
Move removal of dead code from switch stmts to remove_dead_code, this
change enables processing of switch stmts whose parent is not list of
stmts
current minification processes stmts whose parents are block stmts and
they are last stmt of set block, this change also allows us to remove
empty blocks and last break from switch cases whose parent is not block
stmt
```js
if (a) { b(); if (c) switch (d) { case 1: case 2: break; } c(); }
// ^~~~~~ due to body not being a block we where not able to process this
// Current:
if (a) { if (b(), c) switch (d) { case 1: case 2: break } c() }
// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this switch case is not being processed
// This branch:
a && (b(), c && d, c());
// ^ switch cases can be correctly processed
```
note: this change applies only dce, and dosn't substitute switch stmts
with if'stmts
#### changes in stack:
- https://github.com/oxc-project/oxc/pull/25405
- https://github.com/oxc-project/oxc/pull/25403 👈
- `main` A
Armano committed
b6e9e5efdab2ae76f6828b9f633e1b2d936a7971
Parent: fd61cd8
Committed by GitHub <noreply@github.com>
on 8/23/2026, 2:08:10 PM