fix inline of catch-scoped variables (#3077)

fixes #3076
This commit is contained in:
Alex Lam S.L
2018-04-11 15:44:43 +08:00
committed by GitHub
parent ba7069d52b
commit 6a916523d4
2 changed files with 41 additions and 0 deletions

View File

@@ -2267,3 +2267,39 @@ issue_3054: {
}
expect_stdout: "true true"
}
issue_3076: {
options = {
dead_code: true,
inline: true,
sequences: true,
unused: true,
}
input: {
var c = "PASS";
(function(b) {
var n = 2;
while (--b + function() {
e && (c = "FAIL");
e = 5;
return 1;
try {
var a = 5;
} catch (e) {
var e;
}
}().toString() && --n > 0);
})(2);
console.log(c);
}
expect: {
var c = "PASS";
(function(b) {
var n = 2;
while (--b + (e = void 0, e && (c = "FAIL"), e = 5, 1).toString() && --n > 0);
var e;
})(2),
console.log(c);
}
expect_stdout: "PASS"
}