fix corner case in assignments (#5426)

fixes #5425
This commit is contained in:
Alex Lam S.L
2022-04-19 13:19:30 +08:00
committed by GitHub
parent fbdb7eeda3
commit a0c0c294c5
2 changed files with 31 additions and 3 deletions

View File

@@ -1525,3 +1525,25 @@ issue_5385_2: {
]
node_version: ">=10"
}
issue_5425: {
options = {
assignments: true,
ie: true,
toplevel: true,
unused: true,
yields: true,
}
input: {
var a = "FAIL";
var b = function* f() {}(a ? a = "PASS" : 42);
console.log(a, typeof f);
}
expect: {
var a = "FAIL";
(function* f() {})(a && (a = "PASS"));
console.log(a, typeof f);
}
expect_stdout: "PASS undefined"
node_version: ">=4"
}