fix corner case in merge_vars (#4760)

fixes #4759
This commit is contained in:
Alex Lam S.L
2021-03-10 15:44:49 +00:00
committed by GitHub
parent 58362d5ec7
commit b4944a31a4
2 changed files with 59 additions and 10 deletions

View File

@@ -2620,9 +2620,9 @@ issue_4126_1: {
try {
console.log("PASS");
} catch (e) {
var b = a;
var c = a;
} finally {
var c = b;
var c = c;
}
console.log(c);
}
@@ -3239,3 +3239,45 @@ issue_4653: {
"0",
]
}
issue_4759: {
options = {
merge_vars: true,
toplevel: true,
}
input: {
var i = 2, a = 1, b, c, d;
while (i--) {
try {
if (1 != b) {
d = [];
null.p;
c = d;
} else {
b = 0;
a = c;
}
} catch (e) {}
b = a;
}
console.log(a);
}
expect: {
var i = 2, a = 1, b, c, d;
while (i--) {
try {
if (1 != b) {
d = [];
null.p;
c = d;
} else {
b = 0;
a = c;
}
} catch (e) {}
b = a;
}
console.log(a);
}
expect_stdout: "undefined"
}