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
Mihai Bazon
01d19b4b52
Referencing a global is assumed to have side effects.
...
Close #550
2014-09-28 11:18:25 +03:00
Tal Ater
fb0ec720a4
Compress conditions that have side effects using sequences
2014-09-04 02:57:49 +03:00
Tal Ater
7971ed33d1
Added a test for else if
2014-09-03 01:35:30 +03:00
Tal Ater
885835a655
Compress conditional assignments where all possible outcomes are equivalant and condition has no side effects
2014-09-02 23:30:25 +03:00
Matt Basta
ac0086a745
Simplify nested conditionals if possible
2014-02-06 12:39:13 -08:00
Mihai Bazon
b521b4b926
Conditional/call optimization
...
foo ? bar(x) : bar(y) ==> bar(foo ? x : y)
2013-12-29 10:31:30 +02:00
Mihai Bazon
c11de17e99
added option for side-effect-free statements, fix test
2012-10-03 13:08:03 +03:00
Mihai Bazon
378ed17809
disable hoist_vars by default and change comparations to comparisons
2012-10-03 11:27:05 +03:00
Mihai Bazon
6ad414ef28
minor
2012-09-17 14:33:36 +03:00
Mihai Bazon
7b6a402916
rewrite handle_if_return
...
optimizations of if/return/continue seem to be even better now
2012-09-16 15:46:20 +03:00
Mihai Bazon
d72c1d1293
few more optimizations:
...
- do multiple passes in tighten_body if it was changed
- transform if (foo) return x; return y; ==> return foo?x:y
- don't optimize !0 as true (use best_of after evaluation of constant expr)
With hoist_vars off we now beat UglifyJS v1 on jQuery-1.8.1
2012-09-13 15:20:57 +03:00
Mihai Bazon
f5027ec1fc
minor
2012-09-12 16:29:20 +03:00
Mihai Bazon
a41e6cfabb
more progress on the compressor (WIP)
2012-09-10 16:37:05 +03:00
Mihai Bazon
919b2733ab
always keep declarations found in unreachable code
...
a few more tests and some cleanups.
2012-09-07 15:18:32 +03:00