aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-24 06:33:48 +0100
committerGitHub <noreply@github.com>2020-10-24 13:33:48 +0800
commitc5df8355ba00fdf5ffa81192e0d88cf0dca90061 (patch)
treeaf48bda48ba5fd71857ec9d28d1e08f3bd78d40f /lib/compress.js
parentff38d2471f36815f3d56774092a8d298719fd4fb (diff)
downloadtracifyjs-c5df8355ba00fdf5ffa81192e0d88cf0dca90061.tar.gz
tracifyjs-c5df8355ba00fdf5ffa81192e0d88cf0dca90061.zip
fix corner case in `loops` & `unused` (#4241)
fixes #4240
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index c6e27e06..216ca92a 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -5182,7 +5182,7 @@ merge(Compressor.prototype, {
var def = sym.definition();
if (!def) return;
if (def.id in in_use_ids) return;
- if (def.scope !== self && member(def, self.enclosed)) return;
+ if (def.scope !== self && self.find_variable(sym) === def) return;
log(sym, "Dropping unused loop variable {name}");
if (for_ins[def.id] === node) delete for_ins[def.id];
var body = [];