fix corner case in unused (#3987)

fixes #3986
This commit is contained in:
Alex Lam S.L
2020-06-10 19:01:23 +01:00
committed by GitHub
parent ed69adedcd
commit 596fad182e
2 changed files with 41 additions and 3 deletions

View File

@@ -2755,3 +2755,37 @@ issue_3962_2: {
}
expect_stdout: "PASS"
}
issue_3986: {
options = {
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var a = 0, b = 0;
(function() {
try {
throw 42;
} catch (e) {
a++;
}
b = b && 0;
})(b *= a);
console.log(b);
}
expect: {
var a = 0, b = 0;
(function() {
try {
throw 42;
} catch (e) {
a++;
}
b = b && 0;
})(b *= a);
console.log(b);
}
expect_stdout: "0"
}