Alex Lam S.L
0a65de89b9
fix reduce_vars on AST_Switch ( #1671 )
...
Take conditional nature of switch branches into account.
fixes #1670
2017-03-25 21:17:30 +08:00
Alex Lam S.L
6e86ee950d
fix typeof side-effects ( #1669 )
...
`has_side_effects()` does not take `typeof`'s magical power of not tripping over undeclared variable into account.
fixes #1668
2017-03-25 17:40:18 +08:00
Alex Lam S.L
8ca2401ebe
fix dead_code on AST_Switch ( #1667 )
...
Need to call `extract_declarations_from_unreachable_code()`.
fixes #1663
2017-03-25 16:21:42 +08:00
Alex Lam S.L
491f16c766
v2.8.16
v2.8.16
2017-03-25 03:21:16 +08:00
Alex Lam S.L
a30092e20f
fix invalid AST_For.init ( #1657 )
...
Turns out the only place in `Compressor` which can generate invalid `AST_For.init` is within `drop_unused()`, so focus the fix-up efforts.
supercedes #1652
fixes #1656
2017-03-25 03:18:36 +08:00
Alex Lam S.L
b1abe92e1a
introduce ufuzz.js ( #1655 )
...
closes #1647
2017-03-25 01:46:12 +08:00
Alex Lam S.L
b454ce667e
Update ISSUE_TEMPLATE.md
2017-03-24 23:12:58 +08:00
Alex Lam S.L
32283a0def
fix cascade of evaluate optimisation ( #1654 )
...
Operator has changed, so break out from rest of the rules.
fixes #1649
2017-03-24 22:09:19 +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
Alex Lam S.L
0432a7abb9
fix assignment extraction from conditional ( #1651 )
...
fixes #1645
fixes #1646
2017-03-24 18:52:48 +08:00
Alex Lam S.L
f3a1694a41
fix assignment substitution in sequences ( #1643 )
...
take side effects of binary boolean operations into account
fixes #1639
2017-03-24 14:30:31 +08:00
Alex Lam S.L
2e0dc97003
improve error marker placement ( #1644 )
...
For AST_UnaryPrefix, points to the operator rather than end of expression.
2017-03-24 14:28:40 +08:00
Alex Lam S.L
701035621d
fix expect_stdout ( #1642 )
...
`compress()` may modify input ASTs
add tests for #1627 & #1640
2017-03-24 13:19:50 +08:00
kzc
79334dda10
fix regression: CLI options with hyphens like -b ascii-only ( #1640 )
...
fixes #1637
2017-03-24 11:55:03 +08:00
Alex Lam S.L
e918748d88
improve collapsible value detection ( #1638 )
...
- #1634 bars variables with cross-scope references in between to collapse
- but if assigned value is side-effect-free, no states can be modified, so it is safe to move
2017-03-24 02:55:32 +08:00
Alex Lam S.L
9e2290b29c
Merge pull request #1636 from alexlamsl/harmony-v2.8.15
...
Merging from master for 2.8.15
harmony-v2.8.15
2017-03-23 16:08:53 +08:00
alexlamsl
97d0fc271d
Merge branch 'master' into harmony-v2.8.15
2017-03-23 15:28:17 +08:00
Alex Lam S.L
6b2f34769a
v2.8.15
v2.8.15
2017-03-23 13:36:47 +08:00
Alex Lam S.L
48ffbef51d
account for cross-scope modifications in collapse_vars ( #1634 )
...
mostly done by @kzc
fixes #1631
2017-03-23 07:17:34 +08:00
Alex Lam S.L
c0f3feae9f
introduce compressor.info() ( #1633 )
...
report the following only when `options.warnings = "verbose"`
- unused elements due to inlining
- collpased variables
2017-03-23 06:49:49 +08:00
Alex Lam S.L
a00040dd93
fix a bug in simple_glob ( #1632 )
...
- "?" should not match "/"
- other minor clean-ups
2017-03-23 06:11:16 +08:00
Alex Lam S.L
ee95c1b38b
metadata cleanup ( #1630 )
...
- mention performance anomaly in Node 7 and drop from CI
- remove unused npm "scripts"
- mark browserify dependency as optional
- stop `test/mozilla-ast.js` from spamming console output in later versions of Node.js
2017-03-23 01:31:46 +08:00
Alex Lam S.L
4bceb85cbf
throw parse error on invalid assignments ( #1627 )
...
fixes #1626
2017-03-21 14:11:32 +08:00
Alex Lam S.L
7906033e82
Merge pull request #1624 from alexlamsl/harmony-v2.8.14
...
Merging from master for 2.8.14
harmony-v2.8.14
2017-03-19 18:24:29 +08:00
alexlamsl
4bf21ce5c1
add expect_stdout to tests
2017-03-19 15:35:39 +08:00
alexlamsl
44d6b47bdc
Merge branch 'master' into harmony-v2.8.14
2017-03-19 15:31:18 +08:00
Alex Lam S.L
30a75049f5
v2.8.14
v2.8.14
2017-03-19 15:24:57 +08:00
Alex Lam S.L
a3cc3a9b87
make expect_stdout work on Node.js 0.12 ( #1623 )
...
That particular version of Node.js has messed up error messages, so provide a version-specific workaround.
Also fixed an formatting issue which would cause `expect_stdout` to fail if error message contains excerpts of input.
Apply `expect_stdout` to more applicable tests.
2017-03-19 12:00:32 +08:00
Alex Lam S.L
96f8befdd7
fix commit 88fb83a ( #1622 )
...
The following is wrong:
`a == (b ? a : c)` => `b`
Because:
- `b` may not be boolean
- `a` might have side effects
- `a == a` is not always `true` (think `NaN`)
- `a == c` is not always `false`
2017-03-19 11:59:42 +08:00
Alex Lam S.L
cd58635dcc
fix AST_Binary.lift_sequences() ( #1621 )
...
Commit eab99a1c fails to account for side effects from compound assignments.
2017-03-19 03:04:22 +08:00
Alex Lam S.L
274331d0ea
transform String.charAt() to index access ( #1620 )
...
Guarded by `unsafe` as `charAt()` can be overridden.
2017-03-19 02:17:15 +08:00
Alex Lam S.L
129e449c8e
Merge pull request #1614 from alexlamsl/harmony-v2.8.13
...
Merging from master for 2.8.13
harmony-v2.8.13
2017-03-18 13:02:09 +08:00
alexlamsl
75c3c8963f
Merge branch 'master' into harmony-v2.8.13
2017-03-18 02:52:45 +08:00
Alex Lam S.L
0489d6de64
handle runtime errors in expect_stdout ( #1618 )
...
allow test to pass if both `input` and `expect` throws the same kind of error
2017-03-18 02:33:51 +08:00
Alex Lam S.L
fb092839c2
fix top-level directives in compress tests ( #1615 )
...
`input` and `expect` are parsed as `AST_BlockStatement` which does not support `AST_Directive` by default.
Emulate that by transforming preceding `AST_SimpleStatement`s of `AST_String` into `AST_Directive`.
2017-03-18 01:56:15 +08:00
Alex Zaworski
d26b7522d9
Allow 'name' as object literal shorthand property ( #1617 )
...
fixes #1613
2017-03-18 01:29:13 +08:00
Christian Maughan Tegnér
b7c112eefe
Add --in-source-map inline documentation ( #1611 )
2017-03-17 03:08:38 +08:00
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