Alex Lam S.L
7c5b6f349e
enhance booleans ( #5022 )
...
closes #5021
2021-06-23 00:35:50 +08:00
Alex Lam S.L
d68d155f93
support class literals ( #4658 )
2021-02-23 22:55:08 +08:00
Alex Lam S.L
79e5c3f564
improve warnings ( #4247 )
...
closes #4244
2020-10-27 17:39:33 +08:00
Alex Lam S.L
55451e7b78
support const ( #4190 )
2020-10-12 01:18:57 +08:00
Alex Lam S.L
2dbe40b01b
enhance conditionals ( #4181 )
2020-10-05 15:55:37 +08:00
Alex Lam S.L
2039185051
enhance conditionals ( #4106 )
2020-09-16 05:51:42 +08:00
Alex Lam S.L
9577c8c1b7
fix corner case in conditionals ( #3809 )
...
fixes #3808
2020-04-22 06:30:08 +08:00
Alex Lam S.L
a2fc32c64b
enhance conditionals ( #3805 )
2020-04-20 09:42:13 +08:00
Alex Lam S.L
fd6144d95b
enhance conditionals ( #3798 )
2020-04-18 22:32:22 +08:00
Alex Lam S.L
6092bf23de
fix corner case in evaluate ( #3729 )
2020-02-19 00:41:10 +00:00
Alex Lam S.L
b499e03f82
enhance conditionals ( #3694 )
2020-01-28 12:33:21 +08:00
Alex Lam S.L
1988495d71
fix corner case in conditionals ( #3669 )
...
fixes #3668
2020-01-04 09:24:28 +08:00
Alex Lam S.L
75aa6ef848
enhance conditionals ( #3643 )
2019-12-22 04:29:32 +00:00
Alex Lam S.L
5045e140b1
fix corner case in conditionals ( #3577 )
...
fixes #3576
2019-11-09 00:53:15 +08:00
Alex Lam S.L
3797458365
enhance conditionals ( #3557 )
2019-10-31 09:33:46 +08:00
Alex Lam S.L
e5436ca566
enhance side_effects ( #3384 )
2019-04-25 15:15:50 +08:00
Alex Lam S.L
a206964c0a
enhance side_effects ( #3383 )
2019-04-25 04:14:21 +08:00
Alex Lam S.L
615ae37ca3
introduce assignments ( #3345 )
2019-03-18 21:28:41 +08:00
Alex Lam S.L
008c236137
fix corner case in conditionals ( #3329 )
...
fixes #3245
fixes #3257
fixes #3260
fixes #3269
fixes #3271
fixes #3278
fixes #3309
fixes #3319
fixes #3321
2019-03-13 04:28:21 +08:00
Alex Lam S.L
ce7e220de4
fix corner case in conditionals ( #3244 )
2018-08-30 15:59:05 +08:00
Alex Lam S.L
2bdaca10ae
enhance conditionals ( #3243 )
2018-08-30 01:06:34 +08:00
alexlamsl
5ffc17d4aa
fix corner case in unused
2018-07-01 14:34:42 +08:00
Alex Lam S.L
20ca0f5906
improve truthy compression ( #3009 )
2018-03-16 06:12:59 +08:00
Alex Lam S.L
56e2a369d0
enhance conditionals ( #2966 )
...
- `x ? (y, w) : (z, w)` => `x ? y : z, w`
2018-02-28 23:34:48 +08:00
Alex Lam S.L
09269be974
enhance conditionals ( #2758 )
...
`x ? y || z : z` --> `x && y || z`
2018-01-10 16:59:57 +08:00
Alex Lam S.L
673b071637
enhance join_vars & sequences ( #2697 )
...
- nudge declarations without assignments
- within `AST_BlockStatement`
- across `AST_If`
2018-01-01 00:09:26 +08:00
Alex Lam S.L
ef618332ea
fold cascade functionality into collapse_vars ( #2586 )
2017-12-14 01:20:36 +08:00
Alex Lam S.L
3e34f62a1c
account for side-effects in conditional call inversion ( #2562 )
...
fixes #2560
2017-12-08 01:15:31 +08:00
Alex Lam S.L
9a6b11f8e6
improve boolean compression ( #2548 )
...
fixes #2535
2017-12-01 22:41:35 +08:00
Alex Lam S.L
09b320e8a5
convert to number under boolean context ( #2545 )
2017-12-01 12:52:36 +08:00
Alex Lam S.L
5a1e99d713
improve compression of if conditions ( #2544 )
2017-12-01 06:18:31 +08:00
Alex Lam S.L
2244743545
convert AST_Seq from binary tree to array ( #1460 )
...
- rename `AST_Seq` to `AST_Sequence`
- raise default sequences_limit from 200 to 800
2017-04-12 21:56:27 +08:00
Alex Lam S.L
cf72fe552f
fix delete corner cases ( #1799 )
...
- assignment
- boolean
- conditional
- sequence
2017-04-08 14:25:28 +08:00
Alex Lam S.L
257ddc3bdb
improve compression of undefined, NaN & Infinitiy ( #1748 )
...
- migrate transformation logic from `OutputStream` to `Compressor`
- always turn `undefined` into `void 0` (unless `unsafe`)
- always keep `NaN` except when avoiding local variable redefinition
- introduce `keep_infinity` to suppress `1/0` transform, except when avoiding local variable redefinition
supersedes #1723
fixes #1730
2017-04-01 03:02:14 +08:00
Alex Lam S.L
09f77c7d4d
output optimal representations of NaN & Infinity ( #1723 )
...
- move these optimisations out from `Compressor` to `OutputStream`
- fixes behaviour inconsistency when running uglified code from global or module levels due to redefinition
2017-03-29 18:31:55 +08:00
kzc
5509e51098
optimize conditional when condition symbol matches consequent ( #1684 )
2017-03-26 16:36:33 +08:00
Alex Lam S.L
0432a7abb9
fix assignment extraction from conditional ( #1651 )
...
fixes #1645
fixes #1646
2017-03-24 18:52:48 +08:00
Alex Lam S.L
96f8befdd7
fix commit 88fb83a ( #1622 )
...
The following is wrong:
`a == (b ? a : c)` => `b`
Because:
- `b` may not be boolean
- `a` might have side effects
- `a == a` is not always `true` (think `NaN`)
- `a == c` is not always `false`
2017-03-19 11:59:42 +08:00
Alex Lam S.L
858e6c78a4
warn & drop #__PURE__ iff IIFE is dropped ( #1511 )
...
- consolidate `side-effects` optimisations
- improve string `+` optimisation
- enhance literal & `conditionals` optimisations
2017-02-28 02:25:44 +08:00
Alex Lam S.L
0610c020b1
optimise binary operands with evaluate() ( #1427 )
...
- remove call to evaluate() in is_constant() and let nested optimize() does its job instead
- reject RegExp in is_constant() and remove special case logic under collapse_vars
- operands to conditionals optimisation are now always evaluate()-ed
- throw error in constant_value() instead of returning undefined to catch possible bugs, similar to make_node_from_constant()
- optimise binary boolean operators under `evaluate` instead of `conditionals`
2017-01-26 12:16:50 +01:00
kzc
ace8aaa0f4
Fix conditional expressions of form (x ? -1 : -1)
...
Fixes #1154 , #1153
2016-06-21 14:52:13 -04:00
kzc
98434258d0
Optimize ternaries with boolean consequent or alternative.
...
Fixes #511
2016-04-02 17:22:12 +02:00
kzc
11b0efdf84
boolean_expression ? true : false --> boolean_expression
2016-02-22 17:59:36 +01:00
kzc
774bda13cd
#873 Fix conditionals optimizations with default compress options
2015-11-24 13:27:50 -05:00
kzc
9d398d999c
spacing
2015-06-14 17:45:19 -04:00
kzc
fedb6191a1
optimizations for && and || where left side is constant expression
2015-06-11 23:22:38 -04:00
Mihai Bazon
a5b60217ce
Fix compressing conditionals
...
Only transform foo() ? EXP(x) : EXP(y) into EXP(foo() ? x : y) if EXP has no
side effects.
Fix #710
2015-05-18 13:56:04 +03:00
Mihai Bazon
18c63ff3d8
Fix compression of conditionals
...
Don't move the condition on the right side of an assignment when
the left side may have side effects.
Fix #677
2015-04-13 17:29:48 +03:00
Richard van Velzen
61e850ceb5
Clean up unit test breakage
...
In 992b6b9fcc unit test broke (which I missed). This was due to undeclared variables not being side-effects free.
However, since they're really not side-effect free, just declare them in the test cases.
2015-02-11 21:27:21 +01:00
Tal Ater
a1a4c2ada7
Optimize conditionals where the consequent and alternative are both booleans and not equivalent
2015-01-13 18:27:21 +01:00