fix corner case in merge_vars (#4256)

fixes #4255
This commit is contained in:
Alex Lam S.L
2020-11-01 06:34:07 +00:00
committed by GitHub
parent cbf7269296
commit 68091dbf69
2 changed files with 29 additions and 2 deletions

View File

@@ -3124,3 +3124,25 @@ issue_4253: {
}
expect_stdout: "undefined"
}
issue_4255: {
options = {
dead_code: true,
loops: true,
merge_vars: true,
toplevel: true,
}
input: {
L: for (var a = 2; --a;)
for (var b = 0; console.log(b); --b)
break L;
}
expect: {
L: for (var a = 2; --a;) {
var b = 0;
if (console.log(b))
break L;
}
}
expect_stdout: "0"
}