Alex Lam S.L
257ddc3bdb
improve compression of undefined, NaN & Infinitiy ( #1748 )
...
- migrate transformation logic from `OutputStream` to `Compressor`
- always turn `undefined` into `void 0` (unless `unsafe`)
- always keep `NaN` except when avoiding local variable redefinition
- introduce `keep_infinity` to suppress `1/0` transform, except when avoiding local variable redefinition
supersedes #1723
fixes #1730
2017-04-01 03:02:14 +08:00
Ondřej Španěl
2f93058c6e
More variants of import added ( #1738 )
...
- `import * from "x.js"`
- `import * as Name from "x.js"`
2017-03-31 17:52:56 +08:00
Alex Lam S.L
a0c3836ba0
sort options in alphabetical order ( #1743 )
...
They started off as functional groups I guess, but given the sheer number of options this is becoming too difficult to read.
2017-03-31 16:41:04 +08:00
Alex Lam S.L
11e9bdc427
fix missing preamble when shebang is absent ( #1742 )
2017-03-31 15:26:57 +08:00
alexlamsl
d717bf9ce8
Merge branch 'master' into harmony
2017-03-31 12:54:03 +08:00
Ondřej Španěl
5dea52266b
[ES6] Implemented parse for export Name from Module variants. ( #1701 )
...
- add `AST_Export` new variants output
- add tests to `test/compress/`
- update `$propdoc` of `AST_Export` ("exported_names" & "module_name")
- add tests for `export ... as ...` variants
2017-03-30 17:07:50 +08:00
Alex Lam S.L
2e41cd6394
fix missing parentheses around NaN/Infinity shorthands ( #1726 )
...
fixes #1724
fixes #1725
2017-03-29 20:53:03 +08:00
Alex Lam S.L
09f77c7d4d
output optimal representations of NaN & Infinity ( #1723 )
...
- move these optimisations out from `Compressor` to `OutputStream`
- fixes behaviour inconsistency when running uglified code from global or module levels due to redefinition
2017-03-29 18:31:55 +08:00
Alex Lam S.L
fef0bf9ee0
improve beautified output of switch blocks ( #1721 )
2017-03-29 04:40:05 +08:00
alexlamsl
1e2b0aaa04
Merge branch 'master' into harmony-v2.8.17
2017-03-28 22:03:46 +08:00
Alex Lam S.L
ac51d4c5a0
fix corner case in AST_For.init ( #1652 )
...
Enforce `null` as value for empty initialisation blocks.
fixes #1648
2017-03-24 19:31:17 +08:00
alexlamsl
8f4b45f4f8
Merge branch 'master' into harmony-v2.8.10
2017-03-09 06:02:28 +08:00
Alex Lam S.L
dedbeeff15
plan B for IE8 do-while semi-colon fix ( #1572 )
...
- omitting trailing semi-colon in do-while breaks non-browser parser, e.g. uglify-js 1.x
- trailing semi-colon only breaks IE8 if followed by `else` or `while`
- always use braces in do-while body to workaround 2nd case with no size loss in compression
fixes #1568
2017-03-08 05:07:05 +08:00
alexlamsl
250b782b1e
Merge branch 'master' into harmony-v2.8.8
2017-03-07 20:25:52 +08:00
Alex Lam S.L
a9fc9ddc33
suppress semicolons after do/while ( #1556 )
...
- unless both `beautify` & `screw-ie8` are enabled
- deprecate workaround for if-do-while-else
fixes #186
2017-03-06 17:31:35 +08:00
alexlamsl
49d9ac1c43
Merge branch 'master' into harmony-v2.8.6
2017-03-05 16:03:56 +08:00
Alex Lam S.L
eb98a7f2f3
fix handling of shebang and preamble ( #1545 )
...
fixes #1332
2017-03-05 12:16:02 +08:00
kzc
a0eaff750d
fix parsing of arrow function with bind
...
fixes #1510
2017-02-28 02:47:33 +08:00
alexlamsl
88a338f29e
Merge branch 'master' into harmony-2.8.0
2017-02-27 04:37:48 +08:00
Anthony Van de Gejuchte
07734b000a
Destructuring consistency fixes ( #1417 )
...
- Use AST_Destructuring for lhf assignment patterns
- Use AST_DefaultAssign for default assignments
- Add more checks for lhs expressions
- Add lots of testing
- Cleanup ast (e.g. remove default property)
- Fix #1402 based on a patch from @kzc
- Refine spread allowance in array destructring pattern
- Add destructuring AST tree checker
2017-02-24 08:49:19 +08:00
Anthony Van de Gejuchte
85c1cba760
Remove duplicated code ( #1456 )
...
[ES6] Remove duplicated code
2017-02-24 08:48:13 +08:00
alexlamsl
8898b8a0fe
clean up max_line_len
...
- never exceed specified limit
- otherwise warning is shown
- enabled only for final output
closes #1496
2017-02-21 13:29:58 +08:00
alexlamsl
ac0b61ed6e
remove extraneous spaces between ++/+/--/-
...
fixes #1377
closes #1488
2017-02-21 13:29:58 +08:00
alexlamsl
09f9ae2de9
improve --beautify bracketize
...
reduce whitespaces from if-else statements
fixes #1482
closes #1483
2017-02-21 13:29:58 +08:00
alexlamsl
f0ff6189be
clean up negate_iife
...
- remove extra tree scanning phase for `negate_iife`
- `negate_iife` now only deals with the narrowest form, i.e. IIFE sitting directly under `AST_SimpleStatement`
- `booleans`, `conditionals` etc. will now take care the rest via more accurate accounting
- `a(); void b();` => `a(); b();`
fixes #1288
closes #1451
2017-02-21 13:29:58 +08:00
kzc
abbeb266b5
[ES6] output parens for yield when parented by AST_Dot or AST_Sub ( #1419 )
2017-01-19 17:15:59 +01:00
Anthony Van de Gejuchte
b11c5151bc
Fix regression with non-ascii function identifiers
...
Regression since 110a1ac885
2017-01-19 16:47:37 +01:00
Richard van Velzen
ee26e7f11b
Merge branch 'master' into harmony
2016-11-29 20:50:27 +01:00
Anthony Van de Gejuchte
79b98a9fe8
Do not overwrite options.comments + cleanup
2016-11-29 20:24:08 +01:00
Anthony Van de Gejuchte
c2112d5886
Fix case where a lonely var is used as computed property
2016-11-29 20:19:01 +01:00
Anthony Van de Gejuchte
7e80a979a7
Remove AST_ObjectComputedKeyVal
2016-10-23 22:12:30 +02:00
Richard van Velzen
b7bb706150
Merge branch 'master' into harmony
2016-10-23 22:11:27 +02:00
Anthony Van de Gejuchte
8d74f34373
Don't filter shebangs when using the 'some' comment filter
...
Also clarify documentation a bit more about using regexp as filter
2016-10-23 21:31:03 +02:00
Anthony Van de Gejuchte
32c2cc33bb
Improve binding patterns for arrow functions
2016-10-23 21:13:12 +02:00
Richard van Velzen
6389e52305
Remove console.log and add extra test case
2016-10-06 14:11:32 +02:00
Richard van Velzen
e05510f3bc
Add an option to wrap IIFEs in parenthesis
...
For #1307 .
2016-10-06 14:11:32 +02:00
kzc
88f6ff38d1
[ES6] fix template string escaping of \${...}
2016-10-01 11:32:36 +02:00
Anthony Van de Gejuchte
0111497fc9
Make all comment options in cli available in js api
...
Also removing more code within "loop" while at it.
2016-09-06 17:54:45 +02:00
Anthony Van de Gejuchte
13ed445607
Improve support for binding pattern
...
Including improvements for parameters, variable assignment and
catch parameter.
2016-09-05 17:48:48 +02:00
Richard van Velzen
1db50c3b16
Don't parenthesize arrow functions in parameter lists
2016-09-02 09:35:31 +02:00
Anthony Van de Gejuchte
1c15d0db45
Fix quoting of properties
...
- Make AST_ConciseMethod child of AST_ObjectProperty.
- Fix some typos.
2016-08-26 15:06:24 +02:00
Richard van Velzen
45d81f881b
Merge branch 'master' into harmony
2016-08-17 20:21:38 +02:00
Richard van Velzen
8430123e9d
Fix negate_iife transform to return a correct tree for nested IIFEs
...
Fix for #1256 , partially reverts d854523783
2016-08-17 11:55:59 +02:00
Richard van Velzen
8c7d23dfb1
Merge branch 'master' into harmony
2016-08-17 08:50:31 +02:00
kzc
d854523783
Fix negate_iife regression #1254
2016-08-17 01:29:34 -04:00
Richard van Velzen
c644c1292d
Merge branch 'master' into harmony
2016-08-15 09:09:04 +02:00
kzc
fb049d3a81
Fix unneeded parens around unary args in new expression.
2016-08-14 21:38:38 +02:00
Anthony Van de Gejuchte
27d3669800
Don't allow escaped surrogated identifiers + introduce ascii_identifiers
...
Don't use 2 characters for surrogates in identifiers because there is
support for the \u{} syntax when escaped identifiers were introduced.
Also catch eof errors while reading identifier names
Introduce ascii_identifiers:
By setting ascii_identifiers to undefined (default value),
ascii_identifiers will print identifiers using the same setting as
ascii_only within the limits of the ecmascript 6 grammar.
ascii_identifiers accept true and false, allowing identifiers to be
printed under different settings than strings with the ascii_only setting.
2016-08-14 21:36:06 +02:00
Anthony Van de Gejuchte
110a1ac885
Make distinction between * method and * operator
...
Also add quotes to properties when necessary,
this might be the case if the name isn't a valid
identifier
2016-07-29 21:31:08 +02:00
Anthony Van de Gejuchte
3f8fc3a316
Fix computed getters + cleanup AST
2016-07-21 18:21:46 +02:00