Alex Lam S.L
b2b8a0d386
v2.8.13
v2.8.13
2017-03-17 02:01:33 +08:00
Alex Lam S.L
ac40301813
fix chained evaluation ( #1610 )
...
`reduce_vars` enables substitution of variables but did not clone the value's `AST_Node`.
This confuses `collapse_vars` and result in invalid AST and subsequent crash.
fixes #1609
2017-03-17 00:26:48 +08:00
Alex Lam S.L
3563d8c09e
extend test/run-tests.js to optionally execute uglified output ( #1604 )
...
fixes #1588
2017-03-16 23:20:06 +08:00
Alex Lam S.L
5ae04b3545
make collapse_vars consistent with toplevel ( #1608 )
...
fixes #1605
2017-03-16 13:22:26 +08:00
Alex Lam S.L
a80b228d8b
fix hoist_vars on reduce_vars ( #1607 )
...
`hoist_vars` converts variable declarations into plain assignments, which then confuses `reduce_vars`
fixes #1606
2017-03-16 12:03:30 +08:00
Alex Lam S.L
cf4bf4ceb1
fix stack issues with AST_Node.evaluate() ( #1603 )
...
As patched in #1597 , `make_node_from_constant()` makes inconsistent and sometimes incorrect calls to `optimize()` and `transform()`.
Fix those issues properly by changing the semantics of `evaluate()` and `make_node_from_constant()`, with the side effect that `evaluate()` no longer eagerly converts constant to `AST_Node`.
2017-03-16 01:02:59 +08:00
Alex Lam S.L
8223b2e0db
fix AST_Node.optimize() ( #1602 )
...
Liberal use of `Compressor.transform()` and `AST_Node.optimize()` presents an issue for look-up operations like `TreeWalker.in_boolean_context()` and `TreeWalker.parent()`.
This is an incremental fix such that `AST_Node.optimize()` would now contain the correct stack information when called correctly.
2017-03-15 18:44:13 +08:00
Alex Lam S.L
2fd86d3cb0
Merge pull request #1601 from alexlamsl/harmony-v2.8.12
...
Merging from master for 2.8.12
harmony-v2.8.12
2017-03-14 14:29:32 +08:00
Alex Lam S.L
381bd3836e
minor clean-ups ( #1600 )
...
- remove obsolete optimisation in `AST_Binary` after #1477
- improve `TreeWalker.has_directive()` readability and resilience against multiple visits
2017-03-14 13:19:05 +08:00
alexlamsl
8f7ab602e2
Merge branch 'master' into harmony-v2.8.12
2017-03-14 13:17:42 +08:00
Alex Lam S.L
1dd339f95e
fix unused crashes ( #1599 )
...
- `AST_DefaultAssign` on `keep_fargs`
- `AST_Expansion on` `keep_fargs`
- `AST_Destructuring` on top-level declarations without `toplevel`
2017-03-14 13:13:43 +08:00
Alex Lam S.L
919d5e3482
v2.8.12
v2.8.12
2017-03-11 05:00:55 +08:00
Alex Lam S.L
e3a3db73ae
temporary fix for boolean bug ( #1597 )
...
fixes #1592
2017-03-11 04:59:55 +08:00
Alex Lam S.L
d9344f30b8
disallow parameter substitution for named IIFEs ( #1596 )
...
Self-referenced function has non-fixed values assigned to its parameters.
Let `unused` & `!keep_fnames` do the scanning, then apply `reduce_vars` only to unnamed functions.
fixes #1595
2017-03-11 03:34:55 +08:00
Alex Lam S.L
c7063c1f38
Merge pull request #1591 from alexlamsl/harmony-v2.8.11
...
Merging from master for 2.8.11
harmony-v2.8.11
2017-03-10 16:38:23 +08:00
Alex Lam S.L
be80f7e706
support multi-line string in tests ( #1590 )
...
`expect_exact` sometimes have multiple lines and `\n` are hard to read.
Use array of strings to emulate line breaks and improve readability.
2017-03-10 11:27:30 +08:00
alexlamsl
f4a12b34f2
Merge branch 'master' into harmony-v2.8.11
2017-03-10 11:17:49 +08:00
Alex Lam S.L
cf45e2f79b
fixup for #1585 ( #1589 )
...
As patched on `harmony`, `statement()` is the only user of `embed_tokens()` with a missing error branch.
Updated test case and match up with `harmony` to facilitate future merging.
v2.8.11
2017-03-10 10:49:41 +08:00
Alex Lam S.L
8354758f30
v2.8.11
2017-03-10 04:17:21 +08:00
Alex Lam S.L
9e6b128374
fix catch variable reference in IE8 ( #1587 )
...
`AST_Scope.def_variable()` will overwrite `AST_Symbol.thedef`, so save a copy before calling.
fixes #1586
2017-03-10 03:15:21 +08:00
Michael Mior
93cdb194f4
Correctly raise a parse exception with a missing loop body ( #1585 )
2017-03-10 03:08:43 +08:00
Alex Lam S.L
b633706ce4
fix & improve function argument compression ( #1584 )
...
- one-use function call => IIFE should take `eval()` & `arguments` into account
- if unused parameter cannot be eliminated, replace it with `0`
fixes #1583
2017-03-09 19:11:05 +08:00
Alex Lam S.L
5d5c7934a5
Merge pull request #1582 from alexlamsl/harmony-v2.8.10
...
Merging from master for 2.8.10
2017-03-09 13:14:55 +08:00
alexlamsl
8f4b45f4f8
Merge branch 'master' into harmony-v2.8.10
2017-03-09 06:02:28 +08:00
Alex Lam S.L
e9920f7ca1
v2.8.10
harmony-v2.8.10
v2.8.10
2017-03-09 05:48:06 +08:00
Alex Lam S.L
7e465d4a01
scan RHS of dropped assignments ( #1581 )
...
- similar case as #1578 but against #1450 instead
- fix `this` binding in #1450 as well
closes #1580
2017-03-09 05:22:27 +08:00
Alex Lam S.L
aa80ee349d
remove checkboxes from Issues template
2017-03-08 19:19:54 +08:00
Alex Lam S.L
80e81765cf
explain how to make a proper bug report ( #1579 )
...
fixes #1574
2017-03-08 18:56:01 +08:00
Alex Lam S.L
711f88dcb4
scan assignment value in drop_unused() ( #1578 )
...
those were not optimised for `unused` before, which made it necessary for `reduce_vars` to have separate steps for `keep_fnames`
docs update by @kzc
closes #1577
2017-03-08 18:37:32 +08:00
Alex Lam S.L
344d11d591
v2.8.9
v2.8.9
2017-03-08 12:41:22 +08:00
Alex Lam S.L
c7cdcf06a6
fix function name eliminiation ( #1576 )
...
Function expression can be assigned to a variable and be given a name. Ensure function name is the reduced variable before clearing it out.
fixes #1573
fixes #1575
2017-03-08 12:39:57 +08:00
Alex Lam S.L
3ee55748d4
only run benchmark & jetstream on CI ( #1571 )
2017-03-08 06:00:51 +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
Alex Lam S.L
bd6dee52ab
fix return from recursive IIFE ( #1570 )
...
`side-effects` did not account for IIFEs being able to reference itself thus making its return value potentially significant
2017-03-08 03:31:51 +08:00
Alex Lam S.L
952e2656eb
Merge pull request #1567 from alexlamsl/harmony-v2.8.8
...
Merging from master for 2.8.8
2017-03-07 23:56:23 +08:00
qinayi
240383a314
is_block_scope return true when current node is an instance of AST_IterationStatement. then the scope of let variable can be figured out accurately ( #1561 )
2017-03-07 23:50:58 +08:00
alexlamsl
250b782b1e
Merge branch 'master' into harmony-v2.8.8
2017-03-07 20:25:52 +08:00
Alex Lam S.L
144052ca49
v2.8.8
v2.8.8
2017-03-07 19:58:41 +08:00
Alex Lam S.L
65c848cc6f
include benchmark.js in test suite ( #1564 )
...
- report file sizes and overall run time
- exit with non-zero code upon error
2017-03-07 19:25:12 +08:00
Alex Lam S.L
8a8a94a596
fix deep cloning of labels ( #1565 )
...
`AST_Label.references` get `.initialize()` to `[]` every time after `.clone()`
So walk down the tree to pick up the cloned `AST_LoopControl` pieces and put it back together.
2017-03-07 18:38:27 +08:00
Alex Lam S.L
8153b7bd8a
transform function calls to IIFEs ( #1560 )
...
- expose function body to call sites for potential optimisations
- suppress substitution of variable used within `AST_Defun`
2017-03-07 15:37:52 +08:00
Alex Lam S.L
d787d70127
avoid substitution of global variables ( #1557 )
...
- unless `toplevel` is enabled
- global `const` works as before
2017-03-07 03:11:03 +08:00
kzc
3ac2421932
collapse_vars: do not replace a constant in loop condition or init ( #1562 )
2017-03-07 01:42:33 +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
Alex Lam S.L
3c2b3aeddb
Merge pull request #1554 from alexlamsl/harmony-v2.8.6
...
Merging from master for 2.8.7
harmony-v2.8.7
2017-03-05 23:03:30 +08:00
alexlamsl
aa605495f8
Merge branch 'master' into harmony-v2.8.6
2017-03-05 21:42:34 +08:00
kzc
33a26d456b
patch up #1543 for harmony
...
fixes #1537
2017-03-05 21:39:31 +08:00
Alex Lam S.L
a5d62a3fc6
v2.8.7
v2.8.7
2017-03-05 17:17:08 +08:00
Alex Lam S.L
067e5a5762
fixup for #1553 ( #1555 )
...
- `++a` is the one that is foldable
- transform `a++` into `++a` for better optimisation
2017-03-05 17:15:37 +08:00
alexlamsl
49d9ac1c43
Merge branch 'master' into harmony-v2.8.6
2017-03-05 16:03:56 +08:00