aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-01 20:20:58 +0100
committerGitHub <noreply@github.com>2020-09-02 03:20:58 +0800
commitda8d1545710add4cbe43901b41f56a1446a5eeb5 (patch)
tree539b9ae1ede35e6abd92a3358ab1cd8429ed0b87 /lib
parente33c727e8bf7687c827d3e88974ead18af263d12 (diff)
downloadtracifyjs-da8d1545710add4cbe43901b41f56a1446a5eeb5.tar.gz
tracifyjs-da8d1545710add4cbe43901b41f56a1446a5eeb5.zip
fix corner case in `loops` & `unused` (#4085)
fixes #4084
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index bab390cf..2c21217e 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4682,8 +4682,8 @@ merge(Compressor.prototype, {
}
var def = sym.definition();
if (!def) return;
- if (def.scope !== self) return;
if (def.id in in_use_ids) return;
+ if (def.scope !== self && member(def, self.enclosed)) return;
log(sym, "Dropping unused loop variable {name}");
var value = node.object.drop_side_effect_free(compressor);
if (!value) return in_list ? List.skip : make_node(AST_EmptyStatement, node);