@@ -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) {
|
||||
|
||||
20
test/compress/issue-913.js
Normal file
20
test/compress/issue-913.js
Normal file
@@ -0,0 +1,20 @@
|
||||
keep_var_for_in: {
|
||||
options = {
|
||||
hoist_vars: true,
|
||||
unused: true
|
||||
};
|
||||
input: {
|
||||
(function(obj){
|
||||
var foo = 5;
|
||||
for (var i in obj)
|
||||
return foo;
|
||||
})();
|
||||
}
|
||||
expect: {
|
||||
(function(obj){
|
||||
var i, foo = 5;
|
||||
for (i in obj)
|
||||
return foo;
|
||||
})();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user