fix corner case in dead_code (#5507)

fixes #5506
This commit is contained in:
Alex Lam S.L
2022-06-11 22:26:51 +01:00
committed by GitHub
parent 053cb27fe3
commit 99946a3993
4 changed files with 99 additions and 3 deletions

View File

@@ -1669,3 +1669,41 @@ issue_5106_2: {
}
expect_stdout: "PASS"
}
issue_5506: {
options = {
dead_code: true,
}
input: {
try {
(function(a) {
var b = 1;
(function f() {
try {
b-- && f();
} catch (c) {}
console.log(a);
a = 42 in (a = "bar");
})();
})("foo");
} catch (e) {}
}
expect: {
try {
(function(a) {
var b = 1;
(function f() {
try {
b-- && f();
} catch (c) {}
console.log(a);
a = 42 in (a = "bar");
})();
})("foo");
} catch (e) {}
}
expect_stdout: [
"foo",
"bar",
]
}