fix corner case in if_return (#5675)

This commit is contained in:
Alex Lam S.L
2022-09-22 16:27:06 +01:00
committed by GitHub
parent 43ec350cd2
commit 37d3e4feaa
2 changed files with 33 additions and 4 deletions

View File

@@ -1834,7 +1834,7 @@ switch_return_5: {
]
}
merged_references: {
merged_references_1: {
options = {
if_return: true,
reduce_vars: true,
@@ -1861,6 +1861,36 @@ merged_references: {
expect_stdout: "PASS"
}
merged_references_2: {
options = {
if_return: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
A = "PASS";
var a;
console.log(function(b) {
if (a = b)
return console && a;
a = FAIL;
return console && a;
}(A));
}
expect: {
A = "PASS";
var a;
console.log(function(b) {
if (a = b);
else
a = FAIL;
return console && a;
}(A));
}
expect_stdout: "PASS"
}
issue_5583: {
options = {
conditionals: true,