fix corner case in side_effects (#4326)

fixes #4325
This commit is contained in:
Alex Lam S.L
2020-11-29 02:05:48 +00:00
committed by GitHub
parent f045e2b460
commit 9d34f8428b
5 changed files with 60 additions and 17 deletions

View File

@@ -433,3 +433,40 @@ trim_new: {
}
expect_stdout: "PASS"
}
issue_4325: {
options = {
keep_fargs: "strict",
passes: 2,
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
unused: true,
}
input: {
(function f() {
(function(b, c) {
try {
c.p = 0;
} catch (e) {
console.log("PASS");
return b;
}
c;
})(f++);
})();
}
expect: {
(function() {
(function() {
try {
(void 0).p = 0;
} catch (e) {
console.log("PASS");
return;
}
})();
})();
}
expect_stdout: "PASS"
}