fix corner case in collapse_vars (#3582)

fixes #3581
This commit is contained in:
Alex Lam S.L
2019-11-13 16:45:16 +08:00
committed by GitHub
parent d6fd18d0b0
commit fe65ce9658
2 changed files with 65 additions and 1 deletions

View File

@@ -6468,3 +6468,63 @@ issue_3573: {
}
expect_stdout: "1"
}
issue_3581_1: {
options = {
collapse_vars: true,
}
input: {
var a = "PASS", b = "FAIL";
try {
b = "PASS";
if (a) throw 0;
b = 1 + b;
a = "FAIL";
} catch (e) {}
console.log(a, b);
}
expect: {
var a = "PASS", b = "FAIL";
try {
b = "PASS";
if (a) throw 0;
b = 1 + b;
a = "FAIL";
} catch (e) {}
console.log(a, b);
}
expect_stdout: "PASS PASS"
}
issue_3581_2: {
options = {
collapse_vars: true,
}
input: {
(function() {
var a = "PASS", b = "FAIL";
try {
b = "PASS";
if (a) return;
b = 1 + b;
a = "FAIL";
} finally {
console.log(a, b);
}
})();
}
expect: {
(function() {
var a = "PASS", b = "FAIL";
try {
b = "PASS";
if (a) return;
b = 1 + b;
a = "FAIL";
} finally {
console.log(a, b);
}
})();
}
expect_stdout: "PASS PASS"
}