diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-29 01:00:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 01:00:21 +0800 |
commit | eb48a035e7880e73e7fe4f23727775cff365ffbc (patch) | |
tree | 92d22d7029dc4a1ec6e777c25366070b039d84f2 /lib | |
parent | 6ab3224c0d724322597f5709e3f382cc913d96bb (diff) | |
download | tracifyjs-eb48a035e7880e73e7fe4f23727775cff365ffbc.tar.gz tracifyjs-eb48a035e7880e73e7fe4f23727775cff365ffbc.zip |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js index 64c654dd..3c0fc452 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1896,8 +1896,7 @@ merge(Compressor.prototype, { if (def.value) def.value = def.value.transform(tt); var sym = def.name.definition(); if (sym.id in in_use_ids) return true; - if (sym.orig[0] instanceof AST_SymbolCatch - && sym.scope.parent_scope.find_variable(def.name).orig[0] === def.name) { + if (sym.orig[0] instanceof AST_SymbolCatch) { def.value = def.value && def.value.drop_side_effect_free(compressor); return true; } |