alexlamsl
8891495789
Merge branch 'master' into harmony-v3.1.0
2017-09-10 15:39:33 +08:00
Alex Lam S.L
e5cf7972ea
fix unused patching of AST_For.init blocks ( #2289 )
...
fixes #2288
2017-08-29 01:10:04 +08:00
alexlamsl
3a2b737c42
Merge branch 'master' into harmony-v3.0.25
2017-07-16 11:15:07 +08:00
Alex Lam S.L
5229cb2b1b
drop unused compound assignments ( #2230 )
...
fixes #2226
2017-07-14 00:39:34 +08:00
alexlamsl
5ea1da2d42
handle AST_Expansion in collapse_vars & inline
2017-07-02 18:15:16 +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
Alex Lam S.L
ad139aa34d
fix side_effects on AST_Expansion ( #2165 )
...
fixes #2163
2017-06-27 01:13:00 +08:00
Alex Lam S.L
471db8a717
fix inline & unused on AST_Expansion ( #2138 )
...
- handle rest parameters
- suppress cases with spread arguments
fixes #2136
2017-06-22 01:39:11 +08:00
alexlamsl
daaf1273fa
Merge branch 'master' into harmony-v3.0.18
2017-06-18 15:49:49 +08:00
Alex Lam S.L
33405bb24b
enforce inline scope restriction ( #2106 )
...
fixes #2105
2017-06-16 03:21:38 +08:00
alexlamsl
8af362ed57
Merge branch 'master' into harmony-v3.0.16
2017-06-14 17:09:30 +08:00
Alex Lam S.L
a7971f4e34
fix unused crash with top-level AST_Var ( #2066 )
...
fixes #2063
2017-06-07 19:12:35 +08:00
Alex Lam S.L
540220b91b
fix AST_Function scope invariance ( #2052 )
...
improve function name hack in `run_code()`
2017-06-04 19:27:43 +08:00
Alex Lam S.L
3db2001633
suppress unused on block variables ( #1969 )
...
fixes #1968
2017-05-19 00:28:19 +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
45ce369480
fix AST_For.init patch-up in drop_unused() ( #1839 )
...
fixes #1838
2017-04-23 01:51:56 +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
88e7a542cd
fix unused on labeled for-loop ( #1831 )
...
fixes #1830
2017-04-20 04:18:38 +08:00
Alex Lam S.L
4ffb6fce76
compress duplicated variable definitions ( #1817 )
...
These are surprisingly common, as people reuse the same variable name within loops or switch branches.
2017-04-17 17:11:29 +08:00
alexlamsl
0d8597e904
Merge branch 'master' into harmony-v2.8.22
2017-04-09 15:50:38 +08:00
Alex Lam S.L
cf72fe552f
fix delete corner cases ( #1799 )
...
- assignment
- boolean
- conditional
- sequence
2017-04-08 14:25:28 +08:00
alexlamsl
d717bf9ce8
Merge branch 'master' into harmony
2017-03-31 12:54:03 +08:00
Alex Lam S.L
7bea38a05d
optimize try-catch-finally ( #1731 )
...
- eliminate empty blocks
- flatten out if try-block does not throw
2017-03-30 12:16:58 +08:00
Alex Lam S.L
eb48a035e7
fix corner case in unused ( #1718 )
...
When fixing catch-related issue in #1715 , it tries to optimise for duplicate definitions but did not take anonymous functions into account.
Remove such optimisation for now and we can cover this as a more general rule later.
2017-03-29 01:00:21 +08:00
alexlamsl
1e2b0aaa04
Merge branch 'master' into harmony-v2.8.17
2017-03-28 22:03:46 +08:00
Alex Lam S.L
c909ffb715
fix unused on var of the same name within catch ( #1716 )
...
fixes #1715
2017-03-28 21:25:49 +08:00
Alex Lam S.L
fb177a6312
drop anonymous function name when overshadowed by other declarations ( #1712 )
...
fixes #1709
2017-03-28 17:02:20 +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
alexlamsl
f4a12b34f2
Merge branch 'master' into harmony-v2.8.11
2017-03-10 11:17:49 +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
alexlamsl
8f4b45f4f8
Merge branch 'master' into harmony-v2.8.10
2017-03-09 06:02:28 +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
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
alexlamsl
49d9ac1c43
Merge branch 'master' into harmony-v2.8.6
2017-03-05 16:03:56 +08:00
Alex Lam S.L
07accd2fbb
process code with implicit return statement ( #1522 )
...
Bookmarklet for instance implicitedly assumes a "completion value" without using `return`.
The `expression` option now supports such use cases.
Optimisations on IIFEs also enhanced.
fixes #354
fixes #543
fixes #625
fixes #628
fixes #640
closes #1293
2017-03-03 18:13:07 +08:00
alexlamsl
0b77d861a8
Merge branch 'master' into harmony-v2.8.5
2017-03-03 07:17:52 +08:00
Alex Lam S.L
17b81350d4
fix chained assignment with unused ( #1540 )
...
When #1450 optimises `a=b=42`, it stops after the first variable even if both are unused.
fixes #1539
2017-03-03 04:45:20 +08:00
alexlamsl
88a338f29e
Merge branch 'master' into harmony-2.8.0
2017-02-27 04:37:48 +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
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
b8b133d91a
improve keep_fargs & keep_fnames
...
- utilise in_use_ids instead of unreferenced()
- drop_unused now up-to-date for subsequent passes
closes #1476
2017-02-21 13:29:58 +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
Fábio Santos
634f231b78
First class block scope
...
- Make let, const, and class symbols be declared in a block scope.
- Piggy back on existing catch symbol implementation to get block-aware mangling working
- Make sure unused block-scoped declarations can be dropped
- Don't eliminate a block if it has a block-scoped declaration
- Remove silly empty anonymous blocks left over from drop_unused
- AST_Toplevel now gets to call drop_unused too, since block-scoped variables aren't global!
- Don't consider block declarations global
2016-03-27 19:40:20 +02:00
Richard van Velzen
b14496c742
Merge branch 'master' into harmony
...
Conflicts:
lib/compress.js
2015-10-12 08:54:44 +02:00