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
Function expression can be assigned to a variable and be given a name. Ensure function name is the reduced variable before clearing it out.
fixes#1573fixes#1575
`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.
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#354fixes#543fixes#625fixes#628fixes#640closes#1293
Avoid variable substitution in the following cases:
- use of variable before declaration
- declaration within conditional code blocks
- declaration within loop body
fixes#1518fixes#1525
Patched up `make_node()` without `orig`.
There may be other cases where `start` could be missing, so make it print "undefined" instead of crashing.
fixes#1518
Modules like webpack and grunt-contrib-uglify still uses `ast.transform(compressor)` before `Compressor.compress(ast)` was introduced.
Workaround this compatibility issue by deactivating `reduce_vars` in such case.
Also fix use case with omitted `options` when calling `Compressor()`.
fixes#1516
- Use AST_Destructuring for lhf assignment patterns
- Use AST_DefaultAssign for default assignments
- Add more checks for lhs expressions
- Add lots of testing
- Cleanup ast (e.g. remove default property)
- Fix#1402 based on a patch from @kzc
- Refine spread allowance in array destructring pattern
- Add destructuring AST tree checker
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#1261closes#1448
- support arrays, objects & AST_Node
- support `"a.b":1` on both cli & API
- emit warning if variable is modified
- override top-level variables
fixes#1416closes#1198closes#1469