kzc
ace8aaa0f4
Fix conditional expressions of form (x ? -1 : -1)
...
Fixes #1154 , #1153
2016-06-21 14:52:13 -04:00
kzc
0c003c92a8
Don't replace undefined, NaN and Infinity within with scope
2016-06-21 10:53:29 +02:00
Shrey Banga
e645ba84cf
Respect quote style in object literals
...
The option added in fbbaa42ee5 wasn't
being respected inside object literals, so quoted property names would
still be stripped out with this option.
This is mostly a corner-case, but useful when the output is passed to
something like the Closure compiler, where quoted property names can be
used to prevent mangling.
2016-06-19 21:13:31 +02:00
Anthony Van de Gejuchte
d7971ba0e4
Fix test262 failures related to <, <=, in and instanceof
...
Fixed-by: @kzc
2016-06-15 23:11:08 +02:00
Anthony Van de Gejuchte
6c8e001fee
Stop dropping args in new expressions
2016-06-12 17:17:17 +02:00
David Bau
f99b7b630d
Escape null characters as \0 unless followed by 0-7.
2016-06-12 14:32:32 +02:00
Anthony Van de Gejuchte
ea31da2455
Don't drop unused if scope uses with statement
...
Fix provided by @kzc
2016-06-12 14:30:28 +02:00
Anthony Van de Gejuchte
8287ef6781
Fix uglify attempting to rewrite invalid new expressions
2016-06-08 19:45:21 +02:00
kzc
09d5707a8a
collapse_vars: Do not consider RegExp literals to be constants
...
Fixes #1100
2016-05-27 00:03:51 -04:00
kzc
1e390269d4
Optimize if_return for single if/return cases.
...
Fixes #1089
2016-05-24 17:54:08 +02:00
Richard van Velzen
bc49dfd27a
Completely allow evaluating -0
2016-05-24 17:50:29 +02:00
Richard van Velzen
27eedbc302
Never produce -0 when evaluating expressions (like -"")
...
Fix for #1085 . The major case was already there, but more expressions can result in -0.
2016-05-17 22:34:38 +02:00
kzc
5f464b41e2
Simplify iife new fix
...
as suggested by @rvanvelzen.
Added a test for IIFEs in nested contexts.
2016-05-15 19:12:17 -04:00
kzc
bcc1318d4b
Do not apply negate_iife optimization to new expression
2016-05-09 03:19:28 -04:00
Richard van Velzen
e9224ab444
Add test cases for slightly more esoteric cases
2016-04-26 11:49:55 +02:00
Richard van Velzen
4d9a085687
Add test case for hoisting a single function
2016-04-26 11:43:03 +02:00
Richard van Velzen
4fe630431c
Hoist functions when reversing if (x) return; ... vs. if (!x) ...
...
Fixes #1052
2016-04-23 23:48:33 +02:00
kzc
c55dd5ed74
Add passes compress option. Fix duplicate compress warnings.
2016-04-19 20:05:33 +02:00
Richard van Velzen
4b4528ee05
Prevent endless recursion when evaluating self-referencing consts
...
Fix #1041
2016-04-13 15:03:31 +02:00
Richard van Velzen
187a0caf9d
Add base54.reset() to compress tests
...
Without this reset, char counts bleed to next tests. One test had a bad expect clause.
2016-04-12 20:08:09 +02:00
kzc
3907a5e3b2
Fix warnings for referenced non-hoisted functions.
...
Fixes #1034
Also added `expect_warnings` functionality to test framework.
2016-04-11 18:15:20 +02:00
kzc
98434258d0
Optimize ternaries with boolean consequent or alternative.
...
Fixes #511
2016-04-02 17:22:12 +02:00
kzc
07bb7262d0
Escape all ASCII control characters within strings when using ascii_only.
...
Fixes #1017 .
Tab characters within strings are now output as `\t` in all output modes.
2016-03-24 11:51:54 -04:00
philippsimon
ee6c9fabb7
Fix: Uglified Number.prototype functions on big numbers
2016-03-14 12:41:06 +01:00
kzc
11b0efdf84
boolean_expression ? true : false --> boolean_expression
2016-02-22 17:59:36 +01:00
kzc
5486b68850
Take operator || precendence into account for AST_If optimization.
...
Fixes #979 .
2016-02-21 12:05:02 -05:00
alexlamsl
6547437725
preserve ThisBinding for side_effects
2016-02-17 19:34:01 +01:00
Richard van Velzen
9662228f6a
Don't compress (0, eval)() to eval()
2016-02-16 19:00:48 +01:00
alexlamsl
31a9b05c96
Preserve ThisBinding in conditionals & collapse_vars
...
Fixes #973
2016-02-16 18:47:49 +01:00
kzc
929de2b0de
collapse_vars: fix if/else and ternary operator side effects
2016-01-28 12:17:06 -05:00
kzc
af2472d85e
collapse_vars: fix bug in repeated var defs of same name
2016-01-28 16:48:50 +01:00
kzc
0a38a688f9
fix bug in collapse_vars for right side of "||" and "&&"
2016-01-27 14:18:46 -05:00
kzc
f4c2ea37bf
Collapse single use var definitions
...
Fix #721
2016-01-27 11:48:15 +02:00
Richard van Velzen
b5a7197ae5
Merge pull request #928 from STRML/constPragma
...
Mark vars with /** @const */ pragma as consts so they can be eliminated.
2016-01-20 19:04:36 +01:00
Samuel Reed
1b703349cf
Tighten up @const regex.
2016-01-20 11:35:45 -06:00
Samuel Reed
f97da4294a
Use TreeWalker for more accurate @const results and update tests
2016-01-20 10:54:00 -06:00
Samuel Reed
8b71c6559b
Mark vars with /** @const */ pragma as consts so they can be eliminated.
...
Fixes older browser support for consts and allows more flexibility
in dead code removal.
2016-01-19 13:23:02 -06:00
Anthony Van de Gejuchte
26641f3fb2
Allow operator names as getters/setters
...
Fixes #919
Fix provided by @kzc
2016-01-19 19:28:51 +01:00
Anthony Van de Gejuchte
6605d15783
Never mangle arguments and keep them in their scope
...
Fixes #892
Helped-by: kzc
2016-01-14 19:45:52 +01:00
Mihai Bazon
fe4e9f9d97
Fix hoisting the var in ForIn
...
Close #913
2016-01-05 13:56:52 +02:00
Richard van Velzen
60c4030a4d
Merge pull request #874 from kzc/fix-conditionals
...
#873 Fix `conditionals` optimizations with default compress options
2015-12-26 14:28:33 +01:00
Anthony Van de Gejuchte
0cabedc526
Disable loop optimization for parse-only tests
2015-12-18 19:20:56 +01:00
Anthony Van de Gejuchte
5cd26c005b
Add tests
2015-12-18 14:39:48 +01:00
kzc
774bda13cd
#873 Fix conditionals optimizations with default compress options
2015-11-24 13:27:50 -05:00
kzc
bd0ae6569f
return undefined optimization no longer uses return_void_0 option
2015-10-29 08:19:12 +01:00
kzc
841a661071
more tests for return undefined optimization
2015-10-29 08:19:12 +01:00
kzc
7491d07666
optimize return undefined and return void 0
2015-10-29 08:19:12 +01:00
Richard van Velzen
335e349314
Allow specification beautify options in tests
...
Caught an error in #847 as well - `output` wasn't passed anywhere which led to an exception. `options` was available though.
2015-10-28 20:50:01 +01:00
kzc
dff54a6552
Fix other operator output related to <!-- or -->
2015-10-13 01:17:10 -04:00
kzc
9f1f21b810
Output -- > instead of --> in expressions. Escape <!-- and --> within string literals.
2015-10-12 10:19:17 +03:00