Commit Graph

109 Commits

Author SHA1 Message Date
Fábio Santos
a9a38ade1d Starting ES6 classes 2016-03-22 11:41:01 +02:00
Fábio Santos
44ecbdf5f0 Accept keyword names as concise method names 2016-03-22 11:41:01 +02:00
Fábio Santos
24b8e1203e Create a new symbol for methods' names 2016-03-22 11:41:01 +02:00
Fábio Santos
8c05450ce0 start concise methods 2016-03-22 11:41:01 +02:00
Fábio Santos
5e1c89db44 Allow 'of' to be a name. 2016-03-22 11:41:01 +02:00
Fábio Santos
bfeb1afad0 computed properties 2016-03-22 11:41:01 +02:00
Fábio Santos
4ec5d8f644 parse, output the let statement 2016-03-22 11:41:00 +02:00
Fábio Santos
a92a14d171 Remove unused state variable in_parameters, and also remove unreachable code (try_an_object always returned an object!) 2016-03-22 11:41:00 +02:00
Fábio Santos
2a24fa8d2b prefixed template strings, like "String.rawfoo\nbar". 2016-03-22 11:41:00 +02:00
Fábio Santos
e0b78bfa5f Parse and output ES6 template strings. Yikes! 2016-03-22 11:41:00 +02:00
Fábio Santos
cfb1b5d848 Starting destructuring expressions 2016-03-22 11:41:00 +02:00
Fábio Santos
048eac6b29 Tolerate expansions in vardefs, too! 2016-03-22 11:41:00 +02:00
Fábio Santos
a170ad9d0d Destructuring vardef in for..of and for..in 2016-03-22 11:41:00 +02:00
Fábio Santos
a3a4ae5ef8 Add holes in destructuring defs, also make them nestable 2016-03-22 11:40:44 +02:00
Fábio Santos
3b189f86ff Parse and compress destructuring VarDefs 2016-03-22 11:40:44 +02:00
Fábio Santos
ebd0682376 Add new-style octal literals and make the B and the O case insensitive. 2016-03-22 11:40:44 +02:00
Fábio Santos
a4d6ed076a Parse binary number literals 2016-03-22 11:40:44 +02:00
Fábio Santos
0a4270b358 Super! 2016-03-22 11:40:26 +02:00
Fábio Santos
7f825c8244 expand parameters
Conflicts:
	test/compress/harmony.js
2016-03-22 11:40:26 +02:00
Fábio Santos
df95318e8b => with destructuring arguments. Requires a lot of parser changes 2016-03-22 11:40:26 +02:00
Fábio Santos
aa127457d5 Adding arrow functions 2016-03-22 11:40:26 +02:00
Fábio Santos
e4b87bface for...of 2016-03-22 11:39:49 +02:00
Fábio Santos
aaa8f25bf0 Starting destructuring. 2016-03-22 11:39:49 +02: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
6f3e35bb3f Fix ch that could contain other newline characters 2015-12-27 22:24:37 +01:00
Anthony Van de Gejuchte
174404c0f3 Do not allow newlines in string literals 2015-12-26 15:08:37 +01:00
Anthony Van de Gejuchte
bd99b00413 Semicolon after do...while statement is optional 2015-12-17 23:02:35 +01:00
Mihai Bazon
08623aa6a7 Fix output for "use asm" code from SpiderMonkey AST
(will only work properly if the SM tree contains "raw" properties for
Literal number nodes)
2015-11-12 12:18:25 +02:00
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
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
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
Richard van Velzen
fcde6109b0 Fix bad parsing of new new x()() constructs
Fixes #739
2015-08-27 12:29:36 +03: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
Mihai Bazon
bce4307e9e Treat \uFEFF as whitespace.
Fix #714
2015-05-20 16:17:46 +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
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
d36faffeca Fix parsing for U+2028 / U+2029
(they should be treated as whitespace)
2015-03-18 10:09:30 +02:00
Edward Casbon
ae07714927 Add filename to the JS_Parse_Error exception.
It would be nice to have access to the filename of the file that includes the code that causes a JavaScript error. This is especially handy if uglifying multiple files at once.

Only a small change is needed for this to happen as it's already available in the function that throws the error.
2015-02-11 23:21:22 +01:00
Mihai Bazon
fbbaa42ee5 Add option to preserve/enforce string quote style
`-q 0` (default) use single or double quotes such as to minimize the number of
 bytes (prefers double quotes when both will do); this is the previous
 behavior.

`-q 1` -- always use single quotes

`-q 2` -- always use double quotes

`-q 3` or just `-q` -- always use the original quotes.

Related codegen option: `quote_style`.

Close #495
Close #460

Some `yargs` guru please tell me why `uglifyjs --help` doesn't display the
help string for `-q` / `--quotes`, and why it doesn't output the expected
argument types anymore, like good old `optimist` did.
2015-01-27 22:26:27 +02:00
Anthony Van de Gejuchte
74cda80d3b Add unicode digit parsing support 2015-01-20 00:17:24 +01:00
Anthony Van de Gejuchte
9a3a848cc8 Update unicode letter 2015-01-20 00:17:03 +01:00
Ingvar Stepanyan
ae5366a31d Track ending lines/columns; fix end locations in Mozilla AST. 2015-01-06 11:32:41 +01:00
Mihai Bazon
13219cebcb Fix handling \r\n
Close #437
2015-01-05 12:14:42 +02:00
Mihai Bazon
f36a1eaa8b Add option to allow return outside of functions.
Close #288
2014-10-20 18:12:13 +03:00
Mihai Bazon
8fbe200012 Always quote property names that contain non-ASCII characters.
Fix #328
2014-04-18 10:48:44 +03:00
Mihai Bazon
1d0127de21 Fix end token for conditionals. Close #404 2014-01-21 10:38:59 +02:00