fix corner cases with logical assignment operators (#4816)

fixes #4815
This commit is contained in:
Alex Lam S.L
2021-03-23 05:02:45 +00:00
committed by GitHub
parent 44394e61c9
commit e7be38b42a
2 changed files with 74 additions and 15 deletions

View File

@@ -549,3 +549,43 @@ logical_side_effects: {
expect_stdout: "PASS"
node_version: ">=15"
}
issue_4815_1: {
options = {
evaluate: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a = "PASS";
42..p &&= a = "FAIL";
console.log(a);
}
expect: {
var a = "PASS";
42..p &&= a = "FAIL";
console.log(a);
}
expect_stdout: "PASS"
node_version: ">=15"
}
issue_4815_2: {
options = {
pure_getters: "strict",
side_effects: true,
}
input: {
var a = "PASS";
42..p &&= a = "FAIL";
console.log(a);
}
expect: {
var a = "PASS";
42..p &&= a = "FAIL";
console.log(a);
}
expect_stdout: "PASS"
node_version: ">=15"
}