patch variable declaractions extracted within catch (#2753)

fixes #2749
This commit is contained in:
Alex Lam S.L
2018-01-09 13:54:35 +08:00
committed by GitHub
parent 2e22d38a02
commit 2972d58dbb
3 changed files with 43 additions and 2 deletions

View File

@@ -833,3 +833,32 @@ issue_2701: {
}
expect_stdout: "function"
}
issue_2749: {
options = {
dead_code: true,
inline: true,
toplevel: true,
unused: true,
}
input: {
var a = 2, c = "PASS";
while (a--)
(function() {
return b ? c = "FAIL" : b = 1;
try {
} catch (b) {
var b;
}
})();
console.log(c);
}
expect: {
var a = 2, c = "PASS";
while (a--)
b = void 0, b ? c = "FAIL" : b = 1;
var b;
console.log(c);
}
expect_stdout: "PASS"
}