Mihai Bazon
7691bebea5
Rework has_directive
...
It's now available during tree walking, i.e. walker.has_directive("use
asm"), rather than as part of the scope. It's thus no longer necessary
to call `figure_out_scope` before codegen. Added special bits in the
code generator to overcome the fact that it doesn't inherit from
TreeWalker.
Fix #861
2015-11-11 22:15:25 +02:00
Mihai Bazon
3c4346728e
Merge pull request #854 from kzc/moz-regexp-2
...
Have mozilla AST RegExpLiteral parser use regex.pattern and regex.flags
2015-11-10 10:12:30 +02:00
Mihai Bazon
18d37ac761
Fix parsing invalid input
...
i.e. `x = 1.xe` — because parseFloat("1.xe") returns 1, this parsed as
`x = 1`.
Ref #857
2015-11-09 13:15:20 +02:00
Richard van Velzen
63d35f8f6d
Prevent ReDoS by not using a regexp to verify floating point numbers
...
`parseFloat` will return `NaN` for invalid numbers anyway, which is the check used to throw the parse error.
Fixes #857
2015-11-09 11:28:27 +01:00
kzc
7dbe961b2d
simplify mozilla AST RegExpLiteral token parse and handle corner cases of regex.pattern better
2015-11-02 13:10:37 -05:00
kzc
94c4daaf9e
Have mozilla AST RegExpLiteral parser use regex.pattern and regex.flags rather than non-standard raw property.
2015-11-02 12:24:09 -05:00
kzc
37ee9de902
rename To_Moz_Literal to To_Moz_RegExp
2015-11-01 10:20:42 -05:00
kzc
83db98ad3b
Fixed RegExp literal in mozilla AST generation/output and added a --dump-spidermonkey-ast flag
2015-11-01 01:02:52 -04:00
kzc
bd0ae6569f
return undefined optimization no longer uses return_void_0 option
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
Michael Ficarra
a887cde9f2
fixes #845 : \v escaping should be restricted to "screw_ie8" mode
2015-10-27 09:05:21 -07:00
Fábio Santos
b5623b19d4
Fix #836
2015-10-20 19:48:56 +01:00
startswithaj
6b2861e086
Make_string was missing \v and wasnt reversing vertical tabs even though read_escaped_char coverts them
2015-10-15 17:42:16 +10:00
kzc
dff54a6552
Fix other operator output related to <!-- or -->
2015-10-13 01:17:10 -04:00
Mihai Bazon
17eef5a3c2
Only encode <!-- and --> in strings when inline_script
2015-10-12 10:21:22 +03:00
kzc
9f1f21b810
Output -- > instead of --> in expressions. Escape <!-- and --> within string literals.
2015-10-12 10:19:17 +03:00
kzc
4d2f7d83af
Fix handling of "use asm" when no command line flags are passed to uglifyjs. SCOPE_IS_NEEDED is unconditionally true now. Refactored floating point literal parsing to be more in keeping with the AST class design.
2015-10-07 13:10:53 -04:00
kzc
593677d2ff
Add proper support for "use asm"; blocks. Disable -c optimization within "use asm"; sections and preserve floating point literals in their original form. Non-asm.js sections are optimized as before. Asm.js sections can still be mangled and minified of whitespace. No special command line flags are required.
2015-10-07 10:00:28 +02:00
Anthony Van de Gejuchte
c69294c449
Implement shebang support
2015-10-06 22:35:45 +02:00
Mihai Bazon
6637c267a5
Fix mozilla-ast after module loading changes
...
Need to explicitly qualify stuff now, since it's not evaluated in some
global scope.
Ref #636
2015-09-24 18:13:21 +03:00
Mihai Bazon
99233c44cc
No longer use vm to load code.
...
Improves performance 2x on node > 0.10.
Ref #636
2015-09-24 17:58:51 +03:00
Mihai Bazon
33528002b4
Fix wrap_commonjs to include code first
...
(code could have directives, i.e. "use strict")
2015-09-24 17:58:51 +03:00
Ville Lautanala
5fd12451f9
Control keeping function arguments with a single option
2015-09-14 19:38:45 +02:00
Richard van Velzen
fcde6109b0
Fix bad parsing of new new x()() constructs
...
Fixes #739
2015-08-27 12:29:36 +03:00
Richard van Velzen
e3bd223dac
Don't change sequences that influence lexical binding in calls
...
Fixes #782
2015-08-25 10:53:35 +02:00
Christopher Chedeau
3ff0b9e0c9
[Fix] --define replaces SymbolRefs in LHS of assignments
...
See #208 for context
2015-08-10 11:22:36 -07:00
Richard van Velzen
759b3f7d6d
Fix mangling of property names which overwrite unmangleable properties
...
Fixes #747 .
2015-08-05 21:18:39 +02:00
Richard van Velzen
66761d7ecf
Fix semicolon printing when restricting max line length
...
Fixes #755
2015-07-30 16:13:32 +02:00
Chris Cowan
9854deb626
Re-use the caught exception's error message in the parse error call.
2015-07-29 15:06:52 +02:00
Chris Cowan
d6814050dd
Give a good error message if an invalid regular expression is found.
2015-07-29 15:05:59 +02:00
thorn0
252fc65558
Advanced way to specify if a function call might have side effects. #400
2015-07-29 14:36:42 +02:00
Mihai Bazon
905b601178
Don't attempt to negate non-boolean AST_Binary
...
Fix #751
2015-07-22 16:55:55 +03:00
Mihai Bazon
63fb2d5a44
Merge pull request #735 from kzc/master
...
optimizations for && and || where left side is constant expression
2015-07-20 09:58:01 +03:00
Mihai Bazon
85a5fc0aeb
Don't drop parens in a * (b * c). Close #744
2015-06-30 10:10:29 +03:00
kzc
f47b2b52a5
operator && and || optimization: add "else" before "if" as intended
2015-06-14 17:44:26 -04:00
kzc
fedb6191a1
optimizations for && and || where left side is constant expression
2015-06-11 23:22:38 -04:00
Joao Carlos
0ac6918a41
Add --mangle-regex option
2015-06-09 14:16:50 +03:00
Mihai Bazon
bce4307e9e
Treat \uFEFF as whitespace.
...
Fix #714
2015-05-20 16:17:46 +03: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
44fd6694eb
fix again reserved props
2015-05-13 22:03:00 +03:00
Mihai Bazon
e48db3a8b6
Make reserved names take priority over the name cache
2015-05-07 15:01:16 +03:00
Mihai Bazon
e637bdaf4e
Only drop the BOM when it's the first character.
...
Close #704
2015-05-05 10:11:38 +03:00
Mihai Bazon
4aed0830e5
Fix blank lines in the output.
...
The issue was more obvious when max_line_len has a small value, rather than
the default 32K characters. A blank line showed up after most statements.
2015-05-04 17:55:42 +03:00
Mihai Bazon
c3a10c135e
Avoid spurious brackets when dropping unused vars
...
Fix #702
2015-05-04 14:49:17 +03:00
Mihai Bazon
92e4340732
Fix parsing strings with literal DOS newlines
...
(should not set newline_before)
Fix #693
2015-04-23 12:08:19 +03:00
Mihai Bazon
7b22f2031f
If name_cache is specified, do rename cached properties
...
(even if --mangle-props is not there)
2015-04-22 17:34:49 +03:00
Mihai Bazon
274e1b3dc7
Drop NaN -> 0/0 transformation.
...
Fix #687
2015-04-17 11:26:36 +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
Mihai Bazon
e04ef56243
Use the before visitor in mangle props
...
(works around a bug in our tree walker which, while cloning nodes, breaks
references between labeled statements and break/continue labels)
2015-04-10 11:33:29 +03:00