fix for-in/of regression with let or const loop variable (#2840)
fixes #2835
This commit is contained in:
@@ -1759,7 +1759,7 @@ merge(Compressor.prototype, {
|
||||
var stat = null;
|
||||
for (var i = 0, len = block.body.length; i < len; i++) {
|
||||
var line = block.body[i];
|
||||
if (line instanceof AST_Definitions && declarations_only(line)) {
|
||||
if (line instanceof AST_Var && declarations_only(line)) {
|
||||
decls.push(line);
|
||||
} else if (stat) {
|
||||
return false;
|
||||
@@ -1803,7 +1803,9 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
}
|
||||
} else if (stat instanceof AST_ForIn) {
|
||||
stat.object = cons_seq(stat.object);
|
||||
if (!(stat.init instanceof AST_Const) && !(stat.init instanceof AST_Let)) {
|
||||
stat.object = cons_seq(stat.object);
|
||||
}
|
||||
} else if (stat instanceof AST_If) {
|
||||
stat.condition = cons_seq(stat.condition);
|
||||
} else if (stat instanceof AST_Switch) {
|
||||
|
||||
Reference in New Issue
Block a user