alexlamsl
f5931866e0
Merge branch 'master' into harmony-v3.0.19
2017-06-22 03:26:49 +08:00
Alex Lam S.L
8709753bfb
fix mangle on export ( #2133 )
...
- `export default ...`
- `export` with `AST_Destructuring`
fixes #2129
2017-06-21 14:22:09 +08:00
Alex Lam S.L
11923e3ae8
reject non-toplevel import/export ( #2128 )
...
fixes #2124
2017-06-21 03:18:48 +08:00
Alex Lam S.L
343ea326c2
ensure mangling works if catch reuses a scope variable ( #2123 )
...
fixes #2120
2017-06-20 02:14:05 +08:00
alexlamsl
78cf35f89c
Merge branch 'master' into harmony-v3.0.17
2017-06-15 19:01:36 +08:00
kzc
100e18305d
first cut of async/await ( #2098 )
...
- async arrow functions not yet supported
fixes #1789
2017-06-15 06:15:48 +08:00
Alex Lam S.L
3f961bbba0
compute uses_arguments correctly in figure_out_scope() ( #2099 )
...
fixes #2097
2017-06-15 03:28:26 +08:00
alexlamsl
8af362ed57
Merge branch 'master' into harmony-v3.0.16
2017-06-14 17:09:30 +08:00
Alex Lam S.L
293c566d6c
marshal mangle[.properties].reserved from non-Array values ( #2072 )
2017-06-09 04:29:12 +08:00
Alex Lam S.L
23265ac253
mangle destructuring function parameters ( #2029 )
...
fixes #2025
2017-05-30 23:41:55 +08:00
alexlamsl
aa835eb0f6
Merge branch 'master' into harmony-v3.0.12
2017-05-27 18:12:10 +08:00
Alex Lam S.L
39d4d7e20a
fix export related issues ( #2005 )
...
- `mangle` non-exported names
- `unused` on `export` of `function`
- `hoist_funs` on `export`
- `export default`
- prohibit definition statements
- parse `AST_Defun` properly
- drop only unused class and function names
fixes #2001
fixes #2004
2017-05-26 13:35:40 +08:00
Alex Lam S.L
c70fb60384
clean up lib/scope.js ( #2003 )
...
fixes #2004
2017-05-26 03:58:35 +08:00
kzc
7bcb442e4c
fix destructuring bugs in mangle and compress ( #1992 )
...
- destructuring mangle
- destructuring array default values
fixes #1335
2017-05-23 02:53:01 +08:00
alexlamsl
81243c4e71
Merge branch 'master' into harmony-v3.0.5
2017-05-15 18:58:54 +08:00
alexlamsl
cd6e849555
Revert "remove support for const ( #1910 )"
...
This reverts commit c391576d52 .
2017-05-15 18:38:16 +08:00
Alex Lam S.L
3ca902258c
fix bugs with getter/setter ( #1926 )
...
- `reduce_vars`
- `side_effects`
- property access for object
- `AST_SymbolAccessor` as key names
enhance `test/ufuzz.js`
- add object getter & setter
- property assignment to setter
- avoid infinite recursion in setter
- fix & adjust assignment operators
- 50% `=`
- 25% `+=`
- 2.5% each for the rest
- avoid "Invalid array length"
- fix `console.log()`
- bypass getter
- curb recursive reference
- deprecate `-E`, always report runtime errors
2017-05-14 02:10:34 +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
Gyusun Yeom
fcd90db30d
fix safari syntax error - declare twice ( #1851 )
...
To avoid Safari bug, scope of for loop should enclose parent scope variables.
fixes #1753
2017-05-11 16:48:43 +08:00
alexlamsl
b4c18f6b83
Merge branch 'master' into harmony-v3.0.0
2017-05-07 15:34:16 +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
Alex Lam S.L
ec443e422c
unify CLI & API under minify() ( #1811 )
...
- rename `screw_ie8` to `ie8`
- rename `mangle.except` to `mangle.reserved`
- rename `mangle.properties.ignore_quoted` to `mangle.properties.keep_quoted`
- compact `sourceMap` options
- more stringent verification on input `options`
- toplevel shorthands
- `ie8`
- `keep_fnames`
- `toplevel`
- `warnings`
- support arrays and unquoted string values on CLI
- drop `fromString` from `minify()`
- `minify()` no longer handles any `fs` operations
- unify order of operations for `mangle_properties()` on CLI & API
- `bin/uglifyjs` used to `mangle_properties()` before even `Compressor`
- `minify()` used to `mangle_properties()` after `Compressor` but before `mangle_names()`
- both will now do `Compressor`, `mangle_names()` then `mangle_properties()`
- `options.parse` / `--parse` for parser options beyond `bare_returns`
- add `mangle.properties.builtins` to disable built-in reserved list
- disable with `--mangle-props builtins` on CLI
- `warnings` now off by default
- add `--warn` and `--verbose` on CLI
- drop `--enclose`
- drop `--export-all`
- drop `--reserved-file`
- use `--mangle reserved` instead
- drop `--reserve-domprops`
- enabled by default, disable with `--mangle-props domprops`
- drop `--prefix`
- use `--source-map base` instead
- drop `--lint`
- remove `bin/extract-props.js`
- limit exposure of internal APIs
- update documentations
closes #96
closes #102
closes #136
closes #166
closes #243
closes #254
closes #261
closes #311
closes #700
closes #748
closes #912
closes #1072
closes #1366
fixes #101
fixes #123
fixes #124
fixes #263
fixes #379
fixes #419
fixes #423
fixes #461
fixes #465
fixes #576
fixes #737
fixes #772
fixes #958
fixes #1036
fixes #1142
fixes #1175
fixes #1220
fixes #1223
fixes #1280
fixes #1359
fixes #1368
2017-04-15 23:50:50 +08:00
alexlamsl
4614b5b46e
Merge branch 'master' into harmony-v2.8.21
2017-04-02 17:25:20 +08:00
Alex Lam S.L
a0c3836ba0
sort options in alphabetical order ( #1743 )
...
They started off as functional groups I guess, but given the sheer number of options this is becoming too difficult to read.
2017-03-31 16:41:04 +08:00
alexlamsl
d717bf9ce8
Merge branch 'master' into harmony
2017-03-31 12:54:03 +08:00
Alex Lam S.L
c595b84032
fix catch symbol mangling ( #1734 )
...
Only need to look up the immediate non-block/catch scope for the same-name special case.
fixes #1733
2017-03-31 02:57:47 +08:00
alexlamsl
1e2b0aaa04
Merge branch 'master' into harmony-v2.8.17
2017-03-28 22:03:46 +08:00
Alex Lam S.L
65da9acce6
handle var within catch of the same name ( #1711 )
...
The following code prints `1`:
var a = 1;
!function(){
a = 4;
try{
throw 2;
} catch (a) {
var a = 3;
}
}();
console.log(a);
fixes #1708
2017-03-28 16:42:39 +08:00
Alex Lam S.L
984a21704e
fix mangle for variable declared within catch block ( #1706 )
...
fixes #1704
2017-03-28 03:26:35 +08:00
Alex Lam S.L
57ce5bd9e0
handle overlapped variable definitions ( #1691 )
...
Process variable definitions with or without assigned values against:
- `arguments`
- named function arguments
- multiple definitions within same scope
Essentially demote variable declarations with no value assignments.
Also fixed invalid use of `AST_VarDef` over `arguments` - should use a member of `AST_SymbolDeclaration` instead.
2017-03-27 01:30:21 +08:00
alexlamsl
75c3c8963f
Merge branch 'master' into harmony-v2.8.13
2017-03-18 02:52:45 +08:00
alexlamsl
f4a12b34f2
Merge branch 'master' into harmony-v2.8.11
2017-03-10 11:17:49 +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
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
49d9ac1c43
Merge branch 'master' into harmony-v2.8.6
2017-03-05 16:03:56 +08:00
Alex Lam S.L
b70591be1a
handle variable declaration within catch blocks ( #1546 )
...
accounts for IE8- scoping
2017-03-05 13:13:44 +08:00
Alex Lam S.L
1f0333e9f1
stay safe with constants in IE8- ( #1547 )
...
- `undefined` etc. can be redefined at top-level for IE8-, so disable related optimisations
- fixed `--support-ie8` catch mangle bug
2017-03-05 12:51:11 +08:00
alexlamsl
c59bf5e8d8
fix SymbolDef.global
...
properly compute for top-level block-variables
2017-02-27 06:20:08 +08:00
alexlamsl
d2d3a6e065
fix double-descend()
...
for `AST_Export` in `AST_Toplevel.figure_out_scope()`
2017-02-27 06:06:09 +08:00
alexlamsl
7755733716
fix "Starting destructuring."
...
commit 32f76f7ff does not take into account `AST_SymbolFunarg` is also `AST_SymbolVar`, so don't need to call `AST_Scope.def_variable()` twice
2017-02-27 05:30:18 +08:00
alexlamsl
88a338f29e
Merge branch 'master' into harmony-2.8.0
2017-02-27 04:37:48 +08:00
Alex Lam S.L
16cd5d57a5
consolidate evaluate & reduce_vars ( #1505 )
...
- improve marking efficiency
- apply smarter `const` replacement to `var`
fixes #1501
2017-02-26 00:40:33 +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
e275148998
enhance global_defs
...
- support arrays, objects & AST_Node
- support `"a.b":1` on both cli & API
- emit warning if variable is modified
- override top-level variables
fixes #1416
closes #1198
closes #1469
2017-02-21 13:29:58 +08:00
alexlamsl
a0f4fd390a
improve reduce_vars and fix a bug
...
- update modified flag between compress() passes
- support IIFE arguments
- fix corner case with multiple definitions
closes #1473
2017-02-21 13:29:58 +08:00
alexlamsl
fa668a28b4
fix corner case in keep_fnames
...
happens when inner function:
- just below top level
- not referenced
- `unused` is disabled
closes #1445
2017-02-18 19:00:54 +08:00
alexlamsl
686a496b1c
remove unused AST_Scope.nesting & AST_SymbolRef.frame
...
they are computed but never used
closes #1444
2017-02-18 18:59:40 +08:00
Richard van Velzen
4bd31607f6
Merge branch 'master' into harmony
2017-01-26 13:02:22 +01:00
Alex Lam S.L
1eaa211e09
fix mangling collision with keep_fnames ( #1431 )
...
* fix mangling collision with keep_fnames
fixes #1423
* pass mangle options to figure_out_scope()
bring command-line in line with minify()
2017-01-26 12:18:28 +01:00
Alex Lam S.L
0d7d4918eb
augment evaluate to extract within objects ( #1425 )
...
- gated by `unsafe`
- replaces previous optimisation specific to String.length
- "123"[0] => 1
- [1, 2, 3][0] => 1
- [1, 2, 3].length => 3
- does not apply to objects with overridden prototype functions
2017-01-26 12:14:18 +01:00