fix corner case in booleans (#5042)

fixes #5041
This commit is contained in:
Alex Lam S.L
2021-06-30 17:52:54 +01:00
committed by GitHub
parent 4ba8b66c5a
commit 611abff49f
2 changed files with 25 additions and 4 deletions

View File

@@ -634,3 +634,24 @@ issue_5028_3: {
}
expect_stdout: "-1"
}
issue_5041: {
options = {
booleans: true,
conditionals: true,
}
input: {
var a = 42;
if (a)
if ([ a = null ])
if (a)
console.log("FAIL");
else
console.log("PASS");
}
expect: {
var a = 42;
a && [ a = null ] && (a ? console.log("FAIL") : console.log("PASS"));
}
expect_stdout: "PASS"
}