Fix hoisting the var in ForIn

Close #913
This commit is contained in:
Mihai Bazon
2016-01-05 13:56:52 +02:00
parent 174404c0f3
commit fe4e9f9d97
2 changed files with 24 additions and 1 deletions

View File

@@ -1276,7 +1276,10 @@ merge(Compressor.prototype, {
var seq = node.to_assignments();
var p = tt.parent();
if (p instanceof AST_ForIn && p.init === node) {
if (seq == null) return node.definitions[0].name;
if (seq == null) {
var def = node.definitions[0].name;
return make_node(AST_SymbolRef, def, def);
}
return seq;
}
if (p instanceof AST_For && p.init === node) {