fix corner case in loops & unused (#4083)

fixes #4082
This commit is contained in:
Alex Lam S.L
2020-08-28 19:42:17 +01:00
committed by GitHub
parent b1cc15e85b
commit f886b3fb2b
2 changed files with 25 additions and 1 deletions

View File

@@ -4800,7 +4800,7 @@ merge(Compressor.prototype, {
return true;
}
if (node instanceof AST_ForIn) {
if (!compressor.option("loops")) return;
if (!drop_vars || !compressor.option("loops")) return;
if (!is_empty(node.body)) return;
if (node.init.has_side_effects(compressor)) return;
node.object.walk(tw);