Anthony Van de Gejuchte
7eb52d2837
Keep const in own scope while compressing
...
- Fixes #1205
- Fix provided by @kzc
2016-07-15 13:20:52 +02:00
kzc
eb63fece2f
Fix mangle with option keep_fnames=true for Safari.
...
Fixes : #1202
2016-07-15 13:18:14 +02:00
Anthony Van de Gejuchte
2650182f47
Backport mocha with test from harmony
2016-07-04 00:51:09 +02:00
Anthony Van de Gejuchte
698705a820
Don't convert all strings to directives from moz-ast
2016-07-03 12:36:57 +02:00
Richard van Velzen
debc525fa1
Introduce a test that tests the --self build
2016-07-01 09:46:05 +02:00
Geraint
85924bb32e
Allow input files to be map (url->filename)
2016-06-30 22:23:59 +02:00
Anthony Van de Gejuchte
a97690fc72
Various LineTerminator changes
...
* Escaped newlines should also produce SyntaxError
* Fix multiline comment parsing and add tests
* Adapt makePredicate to handle \u2028 and \u2029
* Move up nlb check in regex so it's checked before any escape handling
* Change error messages to conform ecma standard
* Find_eol not recornizing \u2028 and \u2029 as line terminator
* Remove \u180e as it is removed in unicode 6.3.0 from the category zs
2016-06-30 22:12:50 +02:00
kzc
02c638209e
Enable --screw-ie8 by default.
...
catch identifier is mangled correctly for ES5 standards-compliant JS engines by default.
Unconditionally use the ie8 if/do-while workaround whether or not --screw-ie8 is enabled.
To support non-standard ie8 javascript use: uglifyjs --support-ie8
2016-06-30 21:49:48 +02:00
kzc
335b72df03
Fix spidermonkey AST (ESTree) export and import, Array holes
...
Fixes : #1156 #1161
Also add test to exercise Uglify after spidermonkey export/import of itself.
2016-06-30 21:44:12 +02:00
Anthony Van de Gejuchte
3a7d53f3cf
Move OctalEscapeSequence to read_escape_char
...
This should simplify and improve implementation, make it easier to
implement template strings, and keep master a bit more in sync with
harmony.
Previous implementation wasn't broken, though the loop gave me the
impression it could read infinite numbers and annoyed me a bit. It was
also slightly unnecessary because the lookup involved only 3 characters.
2016-06-30 21:42:15 +02:00
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
Anthony Van de Gejuchte
85fbf86d7b
Keep master in sync with harmony
...
* Do not mangle when no mangle is required
* Improve use_asm reset while printing code
2016-06-20 18:42:17 +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
6c99816855
Normalize error messages
2016-06-19 21:08:34 +02:00
Anthony Van de Gejuchte
2149bfb707
Don't mix strings with directives in output
...
* Don't interpret strings with escaped content as directive
* Don't interpret strings after empty statement as directive
* Adapt output to prevent strings being represent as directive
* Introduce UGLIFY_DEBUG to allow internal testing like EXPECT_DIRECTIVE
2016-06-19 20:59:17 +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
5c4cfaa0a7
Re-add parens after new expression in beautify mode
2016-06-12 20:03:48 +02:00
Anthony Van de Gejuchte
bb9c9707aa
Don't allow with statements in strict mode
2016-06-12 19:08:16 +02:00
Anthony Van de Gejuchte
6c8e001fee
Stop dropping args in new expressions
2016-06-12 17:17:17 +02:00
Richard van Velzen
9c53c7ada7
Fix octal string strict mode tests
2016-06-12 14:35:43 +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
4d7746baf3
Throw errors in strict mode for octal strings
...
Adds a directive tracker for the parser/tokenizer to
allow parsing depending on directive context.
2016-06-12 14:27:08 +02:00
Anthony Van de Gejuchte
31d5825a86
Catch errors when compression test fails to parse
2016-06-09 21:12:15 +02:00
Anthony Van de Gejuchte
8287ef6781
Fix uglify attempting to rewrite invalid new expressions
2016-06-08 19:45:21 +02:00
Anthony Van de Gejuchte
00ad57e393
Do not allow newlines in regex
2016-06-05 17:02:19 +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
kzc
a0e03c9df4
Retain comments before AST_Constants during mangle.
2016-05-04 20:11:45 +02:00
Anthony Van de Gejuchte
6641dcafb6
Fix regression causing tests to fail on windows
2016-05-04 20:05:51 +02:00
kzc
f39fd3d583
Handle CR line endings in comments.
...
Fixes #1050
2016-05-04 20:02:29 +02: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
kzc
e4fa4b109a
Parse comments without recursion to avoid RangeError.
...
Fixes #993
2016-04-16 02:02:47 -04: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
Mihai Bazon
f68de86a17
Merge pull request #1011 from kzc/dont-produce-let-in-mangle
...
Do not produce `let` as a variable name in mangle.
2016-03-24 18:16:26 +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
kzc
21befe583f
Attempt to increase timeout for mocha let test.
2016-03-15 11:44:09 -04:00
kzc
a9d4a6291b
Do not produce let as a variable name in mangle.
...
Would previously occur in large generated functions with 21,000+ variables.
Fixes #986 .
2016-03-15 11:20:32 -04:00
philippsimon
ee6c9fabb7
Fix: Uglified Number.prototype functions on big numbers
2016-03-14 12:41:06 +01:00