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

@@ -3322,9 +3322,7 @@ issue_3506_1: {
}
expect: {
var a = "FAIL";
!function(b) {
b && (a = "PASS");
}(a);
a && (a = "PASS");
console.log(a);
}
expect_stdout: "PASS"

View File

@@ -525,7 +525,7 @@ issue_2506: {
function f0(bar) {
(function() {
(function() {
if (false <= 0/0 & this >> 1 >= 0)
if (false <= NaN & this >> 1 >= 0)
c++;
})(c++);
})();

View File

@@ -1052,6 +1052,7 @@ issue_4084: {
options = {
keep_fargs: "strict",
loops: true,
passes: 2,
reduce_vars: true,
unused: true,
}

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"
}