fix corner case in merge_vars

fixes #4115
This commit is contained in:
alexlamsl 2020-09-17 01:35:58 +08:00
parent 219aac6a84
commit 577fb8357e
2 changed files with 32 additions and 0 deletions

View File

@ -4376,6 +4376,12 @@ merge(Compressor.prototype, {
pop();
return true;
}
if (node instanceof AST_LabeledStatement) {
push();
node.body.walk(tw);
pop();
return true;
}
if (node instanceof AST_Scope) {
if (node instanceof AST_Lambda) {
references[node.variables.get("arguments").id] = false;

View File

@ -486,3 +486,29 @@ issue_4112: {
}
expect_stdout: "function"
}
issue_4115: {
options = {
merge_vars: true,
toplevel: true,
}
input: {
L: {
var o = typeof console;
for (var k in o)
break L;
var a = 0;
}
console.log(typeof a);
}
expect: {
L: {
var o = typeof console;
for (var k in o)
break L;
var a = 0;
}
console.log(typeof a);
}
expect_stdout: "undefined"
}