Alex Lam S.L
102f994b9d
account for declaration assignment in collapse_vars ( #2859 )
...
fixes #2858
2018-02-01 15:09:53 +08:00
Alex Lam S.L
2a4c68be4f
relax collapse_vars on AST_Exit ( #2855 )
...
First introduced in #1862 to stop assignments to migrate beyond `return` or `throw`. Since then `collapse_vars` has been improved to handle various side-effect-related corner cases.
2018-01-31 23:49:59 +08:00
Alex Lam S.L
6fa3fbeae8
compress chained compound assignments ( #2850 )
2018-01-29 15:13:25 +08:00
Alex Lam S.L
3e7873217c
improve unused on built-in functions ( #2817 )
2018-01-19 20:41:57 +08:00
Alex Lam S.L
b4aef753e7
general improvements around AST_ForIn ( #2796 )
...
- compress using `collapse_vars`
- remove unused `name`
- simplify `loop_body`
2018-01-16 17:03:12 +08:00
Alex Lam S.L
10f961c27b
enhance collapse_vars ( #2788 )
2018-01-15 18:47:23 +08:00
Alex Lam S.L
2972d58dbb
patch variable declaractions extracted within catch ( #2753 )
...
fixes #2749
2018-01-09 13:54:35 +08:00
Alex Lam S.L
4832bc5d88
replace single-use recursive functions ( #2659 )
...
fixes #2628
2017-12-26 21:25:35 +08:00
Alex Lam S.L
b29fc8b27c
improve transversal efficiency in collapse_vars ( #2611 )
...
fixes #2603
2017-12-18 03:00:05 +08:00
Alex Lam S.L
8f681b1d17
handle inline of function arguments ( #2590 )
...
fixes #2476
2017-12-15 13:28:30 +08:00
Alex Lam S.L
738fd52bc4
improve collapse_vars ( #2591 )
...
- handle single-use assignments other than `AST_VarDef`
- scan `AST_Call` for candidates
2017-12-14 15:31:35 +08:00
Alex Lam S.L
9a137e8613
drop local assign-only variable in return ( #2587 )
2017-12-14 02:59:59 +08:00
Alex Lam S.L
ef618332ea
fold cascade functionality into collapse_vars ( #2586 )
2017-12-14 01:20:36 +08:00
Alex Lam S.L
7f418978c9
recover lost opportunities from #2574 ( #2584 )
2017-12-13 18:20:53 +08:00
Alex Lam S.L
04cc395c35
improve collapse_vars on side-effect-free replacements ( #2583 )
2017-12-13 04:52:54 +08:00
Alex Lam S.L
ebfd5c5c74
fix AST_VarDef.may_throw() ( #2580 )
2017-12-12 03:30:25 +08:00
Alex Lam S.L
f2ad542679
fix collapse_vars on switch ( #2578 )
2017-12-11 18:11:09 +08:00
Alex Lam S.L
0e16d92786
handle exceptional flow correctly in collapse_vars ( #2574 )
...
fixes #2571
2017-12-11 00:16:02 +08:00
Alex Lam S.L
32def5ebf5
improve synergy between collapse_vars & unused ( #2521 )
2017-11-28 14:02:39 +08:00
Alex Lam S.L
ecc9f6b770
drop assignment in AST_VarDef.value ( #2522 )
...
fixes #2516
2017-11-28 13:08:40 +08:00
Alex Lam S.L
eb001dc1d9
fix argument/atom collision by collapse_vars ( #2507 )
...
fixes #2506
2017-11-24 07:26:22 +08:00
Alex Lam S.L
8987780db6
eliminate invalid state caching in collapse_vars ( #2502 )
...
fixes #2497
2017-11-24 04:12:37 +08:00
Alex Lam S.L
49fbe9c5ac
fix replacement logic in collapse_vars ( #2475 )
2017-11-13 07:37:42 +08:00
Alex Lam S.L
c6cfa04d10
allow symbol replacement on multiple occurrences ( #2472 )
...
- all-or-nothing replacement
- avoid unmangleable names
fixes #2436
2017-11-12 22:31:47 +08:00
Alex Lam S.L
3c74047368
implement compress option reduce_funcs ( #2466 )
...
- inline single-use function declarations as expressions when permissible
- depend on `reduce_vars`
- enabled by default
- disable for speed critical code
fixes #2464
2017-11-11 05:59:35 +08:00
Alex Lam S.L
1127a2caf3
fix multiple nested function substitutions ( #2458 )
...
fixes #2449
2017-11-09 23:30:00 +08:00
Alex Lam S.L
6c45101870
consolidate & enhance unused ( #2439 )
...
- defer declaration removal in `collapse_vars`
- account for `AST_SymbolFunarg` in deduplication
- private accounting for `collapse_vars`
- avoid issues with identity reference due to deep cloning
fixes #2437
2017-11-06 14:25:10 +08:00
Alex Lam S.L
fe5a68f9d5
maintain call argument order in collapse_vars ( #2426 )
...
fixes #2425
2017-11-05 00:00:18 +08:00
Alex Lam S.L
8a713e449f
deduplicate declarations regardless of toplevel ( #2393 )
2017-10-23 01:00:50 +08:00
Alex Lam S.L
24aa07855b
safer properties transform ( #2391 )
...
`{ a: x, b: y }.a` => `[ x, y ][0]`
- `x` cannot be function containing `this`
`[ x, y, z ][1]` => `(x, z, y)`
- only if `z` is side-effect-free
2017-10-22 20:10:13 +08:00
Alex Lam S.L
0f2ef3367c
enhance collapse_vars around lazy operations ( #2369 )
2017-10-19 04:52:00 +08:00
Alex Lam S.L
7e5b5cac97
fix AST_PropAccess in collapse_vars (take 3) ( #2375 )
...
Suppress scanning beyond assignment to `a.b`
2017-10-18 02:54:51 +08:00
Alex Lam S.L
0d2fe8e3ef
fix AST_PropAccess in collapse_vars (take 2) ( #2372 )
...
fixes #2364
2017-10-17 22:59:15 +08:00
Alex Lam S.L
f2b9c11e2a
fix AST_PropAccess in collapse_vars ( #2370 )
...
fixes #2364
2017-10-17 18:33:03 +08:00
Alex Lam S.L
fe647b083e
account for side-effects from AST_This in collapse_vars ( #2365 )
2017-10-17 01:18:55 +08:00
Alex Lam S.L
b810e2f8da
perform reduce_vars on safe literals ( #2351 )
...
- constant expression
- single reference
- same scope
- not across loop body
2017-10-09 12:25:06 +08:00
Alex Lam S.L
1abe14296e
collapse a.b whenever safe ( #2350 )
2017-10-08 13:17:48 +08:00
Alex Lam S.L
00f509405b
suppress collapse_vars of this into "use strict" ( #2326 )
...
fixes #2319
2017-09-20 05:23:20 +08:00
Alex Lam S.L
4f0953f7e9
handle LHS side-effects on cascade & collapse_vars ( #2314 )
...
fixes #2313
2017-09-16 11:45:19 +08:00
Alex Lam S.L
395a17ccda
fix collapse_vars on default function argument ( #2299 )
...
Avoid collision with local variable `undefined` under certain corner cases.
fixes #2298
2017-09-04 02:32:33 +08:00
Alex Lam S.L
5229cb2b1b
drop unused compound assignments ( #2230 )
...
fixes #2226
2017-07-14 00:39:34 +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
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
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
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
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