Commit Graph

9 Commits

Author SHA1 Message Date
Donny/강동윤
dad73926e6
fix(es/minifier): Fix minifier (#2323)
swc_ecma_minifier:
 - Don't inline literals if a property is mutated.
2021-09-30 07:50:34 +00:00
Donny/강동윤
e8a1710a21
fix(es/minifier): Fix bugs (#2283)
swc_ecma_transforms_optimization:
 - `expr_simplifier`: Don't inject `0` needlessly. (#2257)
2021-09-27 12:05:31 +00:00
Fábio Santos
3f306f0b79
fix(es/minifier): Don't drop used variables (#2272)
swc_ecma_minifier:
 - Don't drop used variables. (#2262)

Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
2021-09-21 16:45:28 +09:00
강동윤
20ce326909
feat(es/minifer): Improve minifier (#2229)
swc_ecma_minifier:
 - `if_return`: Allow side-effect-free statements to come after `if_return`.
 - `collapse_vars`: Move variables without init to first.
 - `analyzer`: Remove useless fields.
 - Don't drop `return` tokens if there's a finally block.
 - `drop_return_value`: Drop side-effect-free return arguments.
 - `make_sequences`: Don't inject `void 0` to return args.
 - `if_terminate`: Move to the pure optimizer.
 - Fix a bug related to `RegExp`.
2021-09-16 04:23:33 +00:00
강동윤
c8b46bf6db
feat(es/minifier): Implement more rules (#2183)
swc_ecma_codegen:
 - Don't panic on `Pat::Invalid`.
 - Fix codegen of unary minus. (#2213)

swc_ecma_minifier:
 - Remove identifier of function expressions if a variable with same name exists.
 - `sequences`: Merge into the argument of a throw statement.
 - Use `ignore_return_value` for `void` expressions.
 - Improve inlining.
 - Drop last `return` if the return value is not used.
 - `sequences`: Merge `c++; use(c)` as `use(++c)`.
 - `sequences`: Merge assignments with an operator.
 - `comparisons`: Optimize the comparison operator if type is equivalent.
 - Fix `negate_cost`.
 - `unused`: Fix order or variable initalizer when variables are dropped.
 - Fix `top_retain` option.
 - `if_return`: Don't merge nested if it's wrong to do so. (#2214)
 - Fix negation of `if_return`.
2021-09-08 09:45:39 +00:00
강동윤
0e30deba1a
feat(es/minifier): Implement more rules (#2058)
swc_ecma_minifier:
 - Enable some sequential merging if `collapse_vars` is set.
 - Enable sequential merging for top level items.
 - `if_return`: Don't inject `void` if it's not exact function body. (#2072)
 - `sequences`: Add some condition for aborting. (#2078)

swc_ecma_utils:
 - Add `collect_decls`.
 - Add `collect_decls_with_ctxt`.

swc_ecma_transforms_optimization:
 - `inline_globals`: Don't replace if a binding exists. (#1294)
2021-08-15 13:09:21 +00:00
강동윤
a7cb2aba9d
fix(es/minifier): Fix bugs of the minifier (#2052)
swc_ecma_minifier:
 - Test mangler using execution test suite.
 - `mangler`: Preserve `arguments`.
 - `mangler`: Handle shorthand. (#2051)
 - `mangler`: Handle object pattern properties.
 - `precompress`: Don't drop function declarations if the variable with same name is in different scope. (#2011)
2021-08-11 07:24:52 +00:00
강동윤
71080dbd26
feat(es/minifier): Implement more rules (#2039)
swc_ecma_minifier:
 - Remove useless `0` in sequence expressions.
 - `analyzer`: Don't treat fn decl as fn expr.
 - `sequences`: Use sequence expressions in front of `b`.
 - `if_return`: Drop else token within same pass. (#2044)
 - Fix counting logic for `pass`. (#2044)
 - `analyzer`: Fix `ref_count`.
 - `hygiene`: Implement `visit_prop_name`.
 - `ignore_return_value`: Property access to function parameters may have side effects.
 - `inline`: Treat `!0` as literal.
 - Remove some dead codes if `unused` is enabled.

swc_ecma_utils:
 - Fix `may_have_side_effects`.
2021-08-10 08:52:28 +00:00
강동윤
9793926cc8
fix(es/minifier): Fix bugs and implement more rules (#2032)
swc_ecma_minifier:
 - Fix an infinite loop. (#2028)
 - Don't remove span hygiene. (#2022)

swc_ecma_codegen:
 - Fix codegen of `return` with `async` arrow. (#2020)

swc:
 - Respect `minify = false`. (#2019)
2021-08-08 14:19:04 +00:00