properly cover all cases of for-in loop variables (#1536)

This commit is contained in:
Alex Lam S.L
2017-03-03 02:39:57 +08:00
committed by GitHub
parent fe9227a41b
commit 70d72ad806
2 changed files with 22 additions and 7 deletions

View File

@@ -243,13 +243,13 @@ merge(Compressor.prototype, {
return true;
}
if (node instanceof AST_ForIn) {
if (node.init instanceof AST_SymbolRef) {
var d = node.init.definition();
d.references.push(node.init);
d.fixed = false;
} else {
node.init.walk(tw);
var sym = node.init;
if (sym instanceof AST_Var) {
sym = sym.definitions[0].name;
}
var d = sym.definition();
d.references.push(sym);
d.fixed = false;
node.object.walk(tw);
push();
node.body.walk(tw);