Age | Commit message (Collapse) | Author |
|
`AST_Label.references` get `.initialize()` to `[]` every time after `.clone()`
So walk down the tree to pick up the cloned `AST_LoopControl` pieces and put it back together.
|
|
- expose function body to call sites for potential optimisations
- suppress substitution of variable used within `AST_Defun`
|
|
- unless `toplevel` is enabled
- global `const` works as before
|
|
|
|
- unless both `beautify` & `screw-ie8` are enabled
- deprecate workaround for if-do-while-else
fixes #186
|
|
- `++a` is the one that is foldable
- transform `a++` into `++a` for better optimisation
|
|
- consolidate `cascade` optimisations
- support ++/-- postfixes
- remove redundant optimisation identified in #1460
fixes #368
|
|
accounts for IE8- scoping
|
|
`unsafe` turns undefined keyword into a variable of the same name if found, but that interferes with other related optimisations.
Keep track of such transformations to ensure zero information loss in the process.
|
|
- `undefined` etc. can be redefined at top-level for IE8-, so disable related optimisations
- fixed `--support-ie8` catch mangle bug
|
|
|
|
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
|
|
safe operations
- `a === b` => `a == b`
- `a + -b` => `a - b`
- `-a + b` => `b - a`
- `a+ +b` => `+b+a`
associative operations
(bit-wise operations are safe, otherwise `unsafe_math`)
- `a + (b + c)` => `(a + b) + c`
- `(n + 2) + 3` => `5 + n`
- `(2 * n) * 3` => `6 * n`
- `(a | 1) | (2 | d)` => `(3 | a) | b`
fixes #412
|
|
When #1450 optimises `a=b=42`, it stops after the first variable even if both are unused.
fixes #1539
|
|
fixes #1537
|
|
|
|
fixes #1533
|
|
- fails to handle `break` in body
fixes #1532
|
|
|
|
|
|
- "" + "a" => "a"
- "" + a + "b" => a + "b"
- "a" + "" => "a" (improving on #45)
|
|
Avoid variable substitution in the following cases:
- use of variable before declaration
- declaration within conditional code blocks
- declaration within loop body
fixes #1518
fixes #1525
|
|
|
|
- consolidate `side-effects` optimisations
- improve string `+` optimisation
- enhance literal & `conditionals` optimisations
|
|
- improve marking efficiency
- apply smarter `const` replacement to `var`
fixes #1501
|
|
- fix corner cases in `const` optimisation
- deprecate `/*@const*/`
fixes #1497
closes #1498
|
|
A function call or IIFE with an immediately preceding comment
containing `@__PURE__` or `#__PURE__` is deemed to be a
side-effect-free pure function call and can potentially be
dropped.
Depends on `side_effects` option.
`[#@]__PURE__` hint will be removed from comment when pure
call is dropped.
fixes #1261
closes #1448
|
|
- only drops side-effect-free arguments
- drop side-effect-free parts with discarded value from `AST_Seq` & `AST_SimpleStatement`
closes #1494
|
|
- never exceed specified limit
- otherwise warning is shown
- enabled only for final output
closes #1496
|
|
- `Array.prototype.slice` => `[].slice`
closes #1491
|
|
closes #1487
|
|
- 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
|
|
fix invalid boolean conversion now exposed in `make_node_from_constant()`
closes #1477
|
|
- update modified flag between compress() passes
- support IIFE arguments
- fix corner case with multiple definitions
closes #1473
|
|
- utilise in_use_ids instead of unreferenced()
- drop_unused now up-to-date for subsequent passes
closes #1476
|
|
previously test cases with the same name would be skipped except for the last one
`test/run-test.js` will now report duplicated names as errors
closes #1461
|
|
closes #1459
|
|
- remove extra tree scanning phase for `negate_iife`
- `negate_iife` now only deals with the narrowest form, i.e. IIFE sitting directly under `AST_SimpleStatement`
- `booleans`, `conditionals` etc. will now take care the rest via more accurate accounting
- `a(); void b();` => `a(); b();`
fixes #1288
closes #1451
|
|
shuffle associative operations to minimise parentheses and aid other uglification efforts
closes #1454
|
|
N = 2:
a;
b;
c;
d;
was:
a, b;
c;
d;
now:
a, b;
c, d;
fixes #1455
closes #1457
|
|
- `do{...}while(false)` => `{...}`
- clean up `AST_While` logic
closes #1452
|
|
fixes
- [a].join() => "" + a
- ["a", , "b"].join() => "a,,b"
- ["a", null, "b"].join() => "a,,b"
- ["a", undefined, "b"].join() => "a,,b"
improvements
- ["a", "b"].join(null) => "anullb"
- ["a", "b"].join(undefined) => "a,b"
- [a + "b", c].join("") => a + "b" + c
closes #1453
|
|
- 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
|
|
closes #1449
|
|
move out of unsafe, guard corner case with screw_id8 instead
closes #1446
|
|
happens when inner function:
- just below top level
- not referenced
- `unused` is disabled
closes #1445
|
|
remove extraneous call to AST_SymbolRef.reference()
closes #1443
|
|
closes #1437
|
|
improved reduce_vars & binary operands produce more optimal results
|
|
* fix mangling collision with keep_fnames
fixes #1423
* pass mangle options to figure_out_scope()
bring command-line in line with minify()
|