Mihai Bazon
e29048b54a
Merge branch 'master' of github.com:mishoo/UglifyJS2
2014-01-26 10:07:10 +02:00
Mihai Bazon
ceb200fe81
Move unescaping regexps under a codegen option (unescape_regexps)
2014-01-26 10:05:55 +02:00
Daniel Stutzman
f5f8239057
Don't unescape \x00 in regexes (it breaks IE8)
2014-01-25 11:55:39 -07:00
Mihai Bazon
931862e97f
More chars that cannot be unescaped in regexps.
2014-01-21 11:44:00 +02:00
Ville Lautanala
1e31011874
Don't unescape byte order marks in regexps
2014-01-19 12:27:03 +02:00
Mihai Bazon
4339bd5cfa
Don't unescape \x2f (slash) in regexps. #54
2014-01-18 12:31:50 +02:00
Mihai Bazon
90a330da16
simplify
2014-01-10 10:36:15 +02:00
Mihai Bazon
cad1f9cbd1
Unescape Unicode sequences in regexps when ascii_only is false. #54
2014-01-10 10:33:58 +02:00
Mihai Bazon
5e4c7f4245
Fix parens for property access -- (foo, bar)["baz"]
2014-01-05 11:48:01 +02:00
Mihai Bazon
7a30d826b8
Better fix for comments in AST_Exit
...
Close #374
2013-12-18 15:54:12 +02:00
Mihai Bazon
be55a09edf
Take out all comments from an AST_Exit's value
...
Fix #372
2013-12-18 13:30:26 +02:00
Mihai Bazon
63287c0e68
Workaround for Safari bug
...
Close #313
2013-10-30 13:59:59 +02:00
Mihai Bazon
c5ed2292bf
Fix parsing setters/getters (allow keywords for name).
...
The "key" property was always "set" or "get", which didn't make much sense.
Now it'll be the actual name of the setter/getter (AST_Node), and the
AST_Accessor object itself, which represents the function, won't store any
name.
Close #319
2013-10-30 11:50:22 +02:00
Mihai Bazon
e4c5302406
Fix output for x = 2 * (a % b / b * c)
...
(issue #337 )
2013-10-30 09:11:55 +02:00
Mihai Bazon
f1b7094a57
Add "preamble" output option
...
Close #335
2013-10-29 11:09:18 +02:00
Mihai Bazon
0358e376f0
Fix codegen for when comments_before is undefined.
...
Fix #333
2013-10-28 09:39:29 +02:00
Mihai Bazon
83ba338bd0
Avoid printing <!-- in the output (HTML5 comment)
2013-09-06 10:10:45 +03:00
Mihai Bazon
7c10b25346
Support HTML5 comment syntax (enabled by default!)
...
See http://javascript.spec.whatwg.org/#comment-syntax
https://github.com/mishoo/UglifyJS/issues/503
https://github.com/marijnh/acorn/issues/62
2013-09-06 09:54:30 +03:00
Mihai Bazon
ed80b4a534
Move support for negate_iife in the compressor, rather than code generator
...
(the code generator doesn't maintain enough context to know whether
the return value is important or discarded)
Fixes #272
2013-08-20 17:45:52 +03:00
Michael Ficarra
d9ad3c7cbf
fixes #259 : don't unnecessarily quote object properties when --screw-ie8
2013-08-18 19:45:06 -05:00
David Glasser
b1febde3e9
Fix output for arrays whose last element is a hole: [1,,]
...
1529ab96 started to do this (by considering holes to be separate from
"undefined") but it still converted
[1,,] (length 2, last element hole, trailing comma)
to
[1,] (length 1, trailing comma)
Unfortunately the test suite doesn't really make this clear: the new test here
passes with or without this patch because run-tests.js beautifys the expected
output (in "make_code"), which does the incorrect transformation! If you make
some manual change to arrays.js to make the test fail and see the INPUT and
OUTPUT, then you can see that without this fix, [1,,] -> [1,], and with this fix
it stays [1,,].
2013-07-18 15:39:22 +03:00
Ville Lautanala
f29f07aabd
Escape null characters as \x00
...
Since \0 might be mistakenly interpreted as octal if followed by a
number and using literal null is in some cases interpreted as end of
string, escape null as \x00.
2013-06-03 20:46:42 +03:00
Mihai Bazon
9fc6796d2a
Add negate_iife option to the code generator.
...
See discussion in a9511dfbe5
2013-05-22 21:22:14 +03:00
Mihai Bazon
22a038e6a2
Fix output of statement: new function(){...};
...
Close #209
2013-05-20 08:27:37 +03:00
Mihai Bazon
a9511dfbe5
Use the negation hack rather than parens for a toplevel function expression call
...
(only in !beautify mode)
2013-05-09 08:58:47 +03:00
Vladimir Zhuravlev
37d7cb8565
Quote objects with numeric keys
2013-03-31 19:52:28 +03:00
Mihai Bazon
a869b854fa
Don't use \xYY for identifiers
...
Fix #173
2013-03-31 13:36:22 +03:00
Andreas Lind Petersen
81f5efe39a
Output, to_ascii: Escape non-ascii chars with \xnn instead of \unnnn whenever possible.
2013-03-31 13:36:22 +03:00
Mihai Bazon
916faf0a48
Force space after literal regexp when used in "instanceof" or "in"
...
Close #118
2013-02-06 11:57:59 +02:00
Mihai Bazon
fdf8b5eb71
Fix parens for NaN
...
Close #116
2013-02-06 11:38:29 +02:00
Mihai Bazon
de7ec7f1b7
Fix parens for negative numbers
...
Close #115
2013-02-06 11:36:04 +02:00
Mihai Bazon
3c8a0bdff4
Fix parens for AST_New
...
Close #114
2013-02-06 11:28:49 +02:00
Mihai Bazon
719a8fd102
Ugly hack to print comments before return/throw statements
...
Close #112
2013-02-05 19:11:39 +02:00
Mihai Bazon
faa354f5ca
[AST_Hole] the print function can be a no-op.
2013-01-17 11:36:10 +02:00
David Glasser
1529ab965a
Fix output for arrays containing undefined values.
...
1b6bcca7 was a first attempt at this. That commit made Uglify stop replacing
holes with undefined, but instead it started replacing undefined with
holes. This is slightly problematic, because there is a difference between a
hole and an undefined value. More problematically, it changed [1,undefined] to
[1,] which generally doesn't even parse as a hole (just as a trailing comma), so
it didn't even preserve the length of the array!
Instead, parse holes as their own special AST node which prints invisibly.
2013-01-17 11:36:10 +02:00
Mihai Bazon
08219f0cee
Fix output when semicolons is off.
...
(need to force a semicolon for the empty body of an `if`)
Close #72
2012-12-21 11:57:08 +02:00
Mihai Bazon
c4993e1e5c
Small cleanup
2012-12-12 11:51:55 +02:00
Mihai Bazon
98978fc827
Add proper parens in "NoIn" expressions.
...
fix #60 .
2012-12-06 12:27:57 +02:00
Richard van Velzen
e98119496a
Add support for somewhat preserving line numbers.
...
Usage: uglifyjs2 -b "beautify=0,preserve_line=1" /path/to/js
ref #46
2012-11-14 15:30:18 +02:00
Mihai Bazon
46be3f2bf1
fix another small regression
...
we do need parens here: `new (foo.bar().baz)`, but not here: `new foo.bar.baz`
2012-11-07 13:31:43 +02:00
Mihai Bazon
80da21dab4
fix regression from 5346fb94 (shouldn't parenthesize i++ in x[i++])
2012-11-07 13:02:51 +02:00
Mihai Bazon
a1ae0c8609
parenthesize property access when it's the expression in New
...
refs #35
2012-11-07 12:26:33 +02:00
Mihai Bazon
a90c1aeafe
further fix for parens around New (refs #35 )
2012-11-07 11:49:06 +02:00
Mihai Bazon
ff388a8d2d
parenthesize a Call expression when its parent is New
...
fix #35
2012-11-07 11:36:15 +02:00
Mihai Bazon
5346fb94bb
add proper parens around unary expressions
...
fix #34
2012-11-07 11:23:50 +02:00
Mihai Bazon
85af942d64
print final semicolon
...
close #28
2012-11-05 13:09:39 +02:00
Mihai Bazon
30faaf13ed
more sequence optimizations (lift some sequences above binary/unary expressions so that we can avoid parens)
2012-10-22 11:58:06 +03:00
Mihai Bazon
6472f9410e
add semicolons option in the code generator (default: true)
...
pass `false` to separate statements with newlines instead of semicolons
2012-10-17 14:52:08 +03:00
Mihai Bazon
8957b3a694
fix small glitches in source map generation
2012-10-16 15:54:12 +03:00
Mihai Bazon
b071c9d079
add parens to AST_Seq whose parent is AST_Unary
2012-10-13 14:32:08 +03:00