fix corner case in collapse_vars (#5780)

fixes #5779
This commit is contained in:
Alex Lam S.L
2023-01-16 15:30:59 +02:00
committed by GitHub
parent a437a61518
commit f0ca9cfbe6
2 changed files with 30 additions and 1 deletions

View File

@@ -9864,7 +9864,8 @@ issue_5276: {
}
expect: {
var a = A = "PASS";
a.p = a.p + null - 42;
a.p += null;
a.p -= 42;
console.log(a);
}
expect_stdout: "PASS"
@@ -10148,3 +10149,26 @@ issue_5719: {
}
expect_stdout: "PASS"
}
issue_5779: {
options = {
collapse_vars: true,
evaluate: true,
pure_getters: "strict",
reduce_vars: true,
toplevel: true,
}
input: {
var a = A = "foo";
a.p = 42;
if (a && !a.p)
console.log("PASS");
}
expect: {
var a = A = "foo";
a.p = 42;
if (a, !a.p)
console.log("PASS");
}
expect_stdout: "PASS"
}