alexlamsl
ef63de6968
handle AST_Arrow IIFEs in collapse_vars
2017-07-08 14:27:06 +08:00
alexlamsl
a556dd2dcb
Merge branch 'master' into harmony-v3.0.24
2017-07-08 13:12:54 +08:00
Alex Lam S.L
71ee91e716
handle duplicate argument names in collapse_vars ( #2215 )
2017-07-08 04:42:35 +08:00
Alex Lam S.L
9306da3c58
suppress collapse_vars of this as call argument ( #2204 )
...
fixes #2203
2017-07-06 01:03:52 +08:00
alexlamsl
e77b6d525c
Merge branch 'master' into harmony-v3.0.23
2017-07-02 17:47:21 +08:00
Alex Lam S.L
8b69a3d18e
drop argument value after collapse_vars ( #2190 )
2017-07-02 04:28:11 +08:00
Alex Lam S.L
d40950b741
improve inline efficiency ( #2188 )
...
... by teaching `collapse_vars` some new tricks.
fixes #2187
2017-07-02 01:05:14 +08:00
alexlamsl
8af362ed57
Merge branch 'master' into harmony-v3.0.16
2017-06-14 17:09:30 +08:00
Alex Lam S.L
3493a182b2
implement function inlining ( #2053 )
...
- empty body
- single `AST_Return`
- single `AST_SimpleStatement`
- avoid `/*#__PURE__*/`
Miscellaneous
- enhance single-use function substitution
fixes #281
2017-06-06 05:49:53 +08:00
Alex Lam S.L
c391576d52
remove support for const ( #1910 )
...
As this is not part of ES5.
2017-05-12 14:57:41 +08:00
alexlamsl
daf44f2b21
Merge branch 'master' into harmony-v3.0.4
2017-05-12 05:13:11 +08:00
Alex Lam S.L
1d407e761e
fix invalid transform on const ( #1919 )
...
- preserve (re)assignment to `const` for runtime error
- suppress `cascade` on `const`, as runtime behaviour is ill-defined
2017-05-12 04:51:44 +08:00
alexlamsl
b4c18f6b83
Merge branch 'master' into harmony-v3.0.0
2017-05-07 15:34:16 +08:00
Alex Lam S.L
dee5a27516
enhance collapse_vars ( #1862 )
...
- extend expression types
- `a++`
- `a=x;`
- extend scan range
- `for(init;;);`
- `switch(expr){case expr:}`
- `a = x; a = a || y;`
- terminate upon `debugger;`
closes #1821
fixes #27
fixes #315
fixes #1858
2017-05-06 16:15:43 +08:00
Alex Lam S.L
f05d4f7af3
improve unused ( #1832 )
...
- extract leading value with side-effects out of `var` statement
- reduce scanning of `AST_Definitions` from 3 passes to just once
2017-04-20 13:06:14 +08:00
Alex Lam S.L
4dcff038cb
improve collapse_vars on AST_Var ( #1828 )
...
Perform the same cascaded scanning within `var` statement as we do on array of statements.
2017-04-19 04:49:09 +08:00
Alex Lam S.L
0f4f01b66c
clean up collapse_vars ( #1826 )
...
- remove overlap in functionality of singular, consecutive reference of constant value
- remove workarounds for previous bugs in `lib/scope.js`
- distribute recursive `collapse_single_use_vars()` calls to their respective `OPT(AST_Node)`
- enable collapsing of variables within a single `AST_Definitions`
2017-04-18 21:45:34 +08:00
Alex Lam S.L
5d9f1da3ab
support safe reassignments in reduce_vars ( #1823 )
...
`var a=1;a=2;x(a)` => `x(2)`
fix pre-existing issues
- reference counting on assignment
- walking of anonymous functions
- chained assignment
2017-04-18 13:38:42 +08:00
alexlamsl
0d8597e904
Merge branch 'master' into harmony-v2.8.22
2017-04-09 15:50:38 +08:00
Alex Lam S.L
06cdb74279
improve pure_getters ( #1786 )
...
- property access to `null` & `undefined` always has side effects
- utilise `reduce_vars` to determine safe property access
- may-be cases treated as side effects unless `unsafe`
2017-04-06 11:18:59 +08:00
alexlamsl
1e2b0aaa04
Merge branch 'master' into harmony-v2.8.17
2017-03-28 22:03:46 +08:00
Alex Lam S.L
861a79ac9f
fix delete related issues in collapse_vars and reduce_vars ( #1689 )
2017-03-26 19:14:30 +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
alexlamsl
97d0fc271d
Merge branch 'master' into harmony-v2.8.15
2017-03-23 15:28:17 +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
alexlamsl
44d6b47bdc
Merge branch 'master' into harmony-v2.8.14
2017-03-19 15:31:18 +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
alexlamsl
75c3c8963f
Merge branch 'master' into harmony-v2.8.13
2017-03-18 02:52:45 +08:00
Alex Lam S.L
5ae04b3545
make collapse_vars consistent with toplevel ( #1608 )
...
fixes #1605
2017-03-16 13:22:26 +08:00
alexlamsl
250b782b1e
Merge branch 'master' into harmony-v2.8.8
2017-03-07 20:25:52 +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
kzc
33a26d456b
patch up #1543 for harmony
...
fixes #1537
2017-03-05 21:39:31 +08:00
alexlamsl
0b77d861a8
Merge branch 'master' into harmony-v2.8.5
2017-03-03 07:17:52 +08:00
kzc
4d63d4f5b3
collapse_vars should not replace constant in for-in init section ( #1538 )
...
fixes #1537
2017-03-03 03:51:15 +08:00
kzc
ee3b39b909
optimize trivial IIFEs returning constants ( #1530 )
2017-03-02 15:11:40 +08:00
alexlamsl
148047fbbf
drop unused: toplevel, assign-only
...
- assign statement does not count towards variable usage by default
- only works with assignments on the same scope level as declaration
- can be disabled with `unused` set to "keep_assign"
- `toplevel` to drop unused top-level variables and/or functions
- `top_retain` to whitelist top-level exceptions
closes #1450
2017-02-21 13:29:57 +08:00
kzc
09d5707a8a
collapse_vars: Do not consider RegExp literals to be constants
...
Fixes #1100
2016-05-27 00:03:51 -04:00
kzc
929de2b0de
collapse_vars: fix if/else and ternary operator side effects
2016-01-28 12:17:06 -05:00
kzc
af2472d85e
collapse_vars: fix bug in repeated var defs of same name
2016-01-28 16:48:50 +01:00
kzc
0a38a688f9
fix bug in collapse_vars for right side of "||" and "&&"
2016-01-27 14:18:46 -05:00
kzc
f4c2ea37bf
Collapse single use var definitions
...
Fix #721
2016-01-27 11:48:15 +02:00