Alex Lam S.L
f7ca4f2297
fix corner cases in switch and undefined ( #1762 )
...
- fix side effects in switch condition for singular blocks
- fix `undefined` confusion with local variable
- gate `OPT(AST_Switch)` with `switches`
fixes #1758
fixes #1759
2017-04-02 14:52:25 +08:00
Alex Lam S.L
fef0bf9ee0
improve beautified output of switch blocks ( #1721 )
2017-03-29 04:40:05 +08:00
Alex Lam S.L
67d0237f73
fix tail trimming of switch blocks ( #1707 )
...
now guarded under `dead_code`
fixes #1705
2017-03-28 03:59:13 +08:00
Alex Lam S.L
c526da59a1
has_side_effects() should take AST_Switch.expression into account (#1699 )
...
fixes #1698
2017-03-27 18:09:35 +08:00
Alex Lam S.L
581630e0a7
fix typeof side effects ( #1696 )
...
`statement_to_expression()` drops `typeof` even if it operates on undeclared variables.
Since we now have `drop_side_effect_free()`, replace and remove this deprecated functionality.
2017-03-27 04:37:42 +08:00
Alex Lam S.L
f5952933a0
preserve side effects in switch expression ( #1694 )
...
fixes #1690
2017-03-27 02:32:46 +08:00
Alex Lam S.L
3276740779
fallthrough should not execute case expression ( #1683 )
...
- de-duplicate trailing cases only, avoid all potential side-effects
- enable switch statement fuzzing
fixes #1680
2017-03-26 16:52:38 +08:00
Alex Lam S.L
94f84727ce
suppress switch branch de-duplication upon side effects ( #1682 )
...
fixes #1679
2017-03-26 13:32:43 +08:00
Alex Lam S.L
f83d370f57
improve switch optimisations ( #1677 )
...
- correctly determine reachability of (default) branches
- gracefully handle multiple default branches
- optimise branches with duplicate bodies
fixes #376
fixes #441
fixes #1674
2017-03-26 05:15:46 +08:00
Alex Lam S.L
8ca2401ebe
fix dead_code on AST_Switch ( #1667 )
...
Need to call `extract_declarations_from_unreachable_code()`.
fixes #1663
2017-03-25 16:21:42 +08:00
Mihai Bazon
dac6efb43d
Drop last default: if it's the last branch and empty
...
Close #141
2013-03-01 13:12:03 +02:00
Mihai Bazon
bdfcbf496b
better solution for the last test in constant switch folding
2012-11-14 12:21:43 +02:00
Mihai Bazon
dba8da4800
optimize constant switch blocks
...
ref. mishoo/UglifyJS#441
2012-11-14 12:06:07 +02:00