Alex Lam S.L
fdc9b9413b
minor improvement to string optimisation ( #1514 )
...
- "" + "a" => "a"
- "" + a + "b" => a + "b"
- "a" + "" => "a" (improving on #45 )
2017-03-02 11:31:39 +08:00
Alex Lam S.L
e27dab7e7c
Merge pull request #1528 from alexlamsl/harmony-v2.8.4
...
Merging from master for 2.8.4
harmony-v2.8.4
2017-03-02 11:22:06 +08:00
alexlamsl
80f3ad3ce0
Merge branch 'master' into harmony-v2.8.4
2017-03-02 11:16:55 +08:00
Alex Lam S.L
40ceddb48a
v2.8.4
v2.8.4
2017-03-02 00:24:49 +08:00
Alex Lam S.L
7aa69117e1
fix corner cases in reduce_vars ( #1524 )
...
Avoid variable substitution in the following cases:
- use of variable before declaration
- declaration within conditional code blocks
- declaration within loop body
fixes #1518
fixes #1525
2017-03-02 00:20:53 +08:00
Alex Lam S.L
bff7ad67bb
v2.8.3
v2.8.3
2017-03-01 15:28:46 +08:00
Alex Lam S.L
c2334baa48
fix crash on missing props to string_template() ( #1523 )
...
Patched up `make_node()` without `orig`.
There may be other cases where `start` could be missing, so make it print "undefined" instead of crashing.
fixes #1518
2017-03-01 15:25:26 +08:00
Alex Lam S.L
22f7af205d
Merge pull request #1521 from alexlamsl/harmony-v2.8.2
...
Merging from master for 2.8.2
harmony-v2.8.2
2017-03-01 11:13:32 +08:00
alexlamsl
8a7a4749c7
Merge branch 'master' into harmony-v2.8.2
2017-03-01 11:06:33 +08:00
Alex Lam S.L
fb2b6c7c6f
v2.8.2
v2.8.2
2017-03-01 04:46:12 +08:00
Alex Lam S.L
f5cbe19b75
invert reduce_vars tracking flag ( #1519 )
...
Modules like webpack and grunt-contrib-uglify still uses `ast.transform(compressor)` before `Compressor.compress(ast)` was introduced.
Workaround this compatibility issue by deactivating `reduce_vars` in such case.
Also fix use case with omitted `options` when calling `Compressor()`.
fixes #1516
2017-03-01 04:12:10 +08:00
Alex Lam S.L
b34fa11a13
fix evaluate on object getter & setter ( #1515 )
2017-03-01 02:03:47 +08:00
Alex Lam S.L
320984c5f5
v2.8.1
v2.8.1
2017-03-01 00:27:08 +08:00
Alex Lam S.L
4365a51237
temporarily disables reduce_vars ( #1517 )
...
... as we investigate #1516
2017-03-01 00:25:43 +08:00
Alex Lam S.L
514fc68f4f
Merge pull request #1509 from alexlamsl/harmony-2.8.0
...
Merging from master for 2.8.0
harmony-v2.8.0
2017-02-28 23:14:25 +08:00
alexlamsl
478aaab469
fix parser test
...
not sure if `start.pos` is correct, but oh well
2017-02-28 14:08:31 +08:00
alexlamsl
ab217539e9
restore sourceMappingURL in test
2017-02-28 13:23:02 +08:00
alexlamsl
a942dc07c4
fix parser tests
...
update exception messages
2017-02-28 03:58:01 +08:00
kzc
a0eaff750d
fix parsing of arrow function with bind
...
fixes #1510
2017-02-28 02:47:33 +08:00
alexlamsl
57777b6cfa
Merge branch 'master' into harmony-2.8.0
2017-02-28 02:28:58 +08:00
Alex Lam S.L
858e6c78a4
warn & drop #__PURE__ iff IIFE is dropped ( #1511 )
...
- consolidate `side-effects` optimisations
- improve string `+` optimisation
- enhance literal & `conditionals` optimisations
2017-02-28 02:25:44 +08:00
kzc
8d205f7f39
fix parser handling of comments
2017-02-27 14:54:47 +08:00
alexlamsl
bc9bfd15a2
fix test
2017-02-27 11:39:48 +08:00
alexlamsl
9fc1c4b3b5
update test
...
top-level block-variables not within blocks are global variables
2017-02-27 06:23:12 +08:00
alexlamsl
c59bf5e8d8
fix SymbolDef.global
...
properly compute for top-level block-variables
2017-02-27 06:20:08 +08:00
alexlamsl
d2d3a6e065
fix double-descend()
...
for `AST_Export` in `AST_Toplevel.figure_out_scope()`
2017-02-27 06:06:09 +08:00
alexlamsl
7755733716
fix "Starting destructuring."
...
commit 32f76f7ff does not take into account `AST_SymbolFunarg` is also `AST_SymbolVar`, so don't need to call `AST_Scope.def_variable()` twice
2017-02-27 05:30:18 +08:00
alexlamsl
b3a987b0df
fix up drop_unused()
2017-02-27 05:11:01 +08:00
alexlamsl
88a338f29e
Merge branch 'master' into harmony-2.8.0
2017-02-27 04:37:48 +08:00
Alex Lam S.L
0b0296eb2a
v2.8.0
v2.8.0
2017-02-27 03:47:54 +08:00
Alex Lam S.L
872270b149
improve error messages ( #1506 )
...
- better inheritance of `Error` sub-classes
- mark parse error against source in CLI
closes #235
closes #348
closes #524
closes #1356
closes #1405
2017-02-27 03:40:54 +08:00
kzc
b1c593a041
add harmony branch details in README ( #1507 )
2017-02-27 01:55:24 +08:00
Alex Lam S.L
13be50a4a9
faster tree transversal ( #1462 )
...
- convert `[].forEach()` to for-loops
2017-02-26 05:58:26 +08:00
Alex Lam S.L
16cd5d57a5
consolidate evaluate & reduce_vars ( #1505 )
...
- improve marking efficiency
- apply smarter `const` replacement to `var`
fixes #1501
2017-02-26 00:40:33 +08:00
Alex Lam S.L
834f9f3924
update docs for pure_funcs & drop_console ( #1503 )
...
closes #1362
closes #1399
2017-02-25 04:13:10 +08:00
Alex Lam S.L
cf0951f726
allow --in-source-map inline ( #1490 )
...
- limited to one input file (or `stdin`)
- only works with built-in parser
fixes #520
2017-02-25 04:11:21 +08:00
Ondřej Španěl
852f78491a
Avoid using exports when undefined ( #1471 )
...
Makes direct usage within web browser easier, even if officially unsupported.
2017-02-24 08:51:24 +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
Alex Lam S.L
229e42cdee
Merge pull request #1485 from alexlamsl/merge-2.8.0
...
2.8.0 staging
2017-02-24 07:33:57 +08:00
alexlamsl
4e49302916
enable collapse_vars & reduce_vars by default
...
- fix corner cases in `const` optimisation
- deprecate `/*@const*/`
fixes #1497
closes #1498
2017-02-24 01:46:57 +08:00
kzc
1e51586996
Support marking a call as pure
...
A function call or IIFE with an immediately preceding comment
containing `@__PURE__` or `#__PURE__` is deemed to be a
side-effect-free pure function call and can potentially be
dropped.
Depends on `side_effects` option.
`[#@]__PURE__` hint will be removed from comment when pure
call is dropped.
fixes #1261
closes #1448
2017-02-21 14:24:18 +08:00
Ondřej Španěl
d48a3080ac
Fix: AST_Accessor missing start / end tokens
...
fixes #1492
closes #1493
2017-02-21 13:32:16 +08:00
alexlamsl
26fbeece1c
fix pure_funcs & improve side_effects
...
- only drops side-effect-free arguments
- drop side-effect-free parts with discarded value from `AST_Seq` & `AST_SimpleStatement`
closes #1494
2017-02-21 13:31:59 +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
ec64acd2c8
introduce unsafe_proto
...
- `Array.prototype.slice` => `[].slice`
closes #1491
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
Anthony Van de Gejuchte
c06a50f338
Add .gitattributes to checkout lf eol style
...
closes #1487
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
7e6331bb39
add benchmark & JetStream tests
...
- `test/benchmark.js` measures performance
- `test/jetstream.js` verifies correctness
- configurable mangle/compress/output options
closes #1479
2017-02-21 13:29:58 +08:00