fix corner case in if_return (#3601)

fixes #3600
This commit is contained in:
Alex Lam S.L
2019-11-19 15:45:20 +08:00
committed by GitHub
parent 67278e76c8
commit d959e0b86f
2 changed files with 32 additions and 0 deletions

View File

@@ -544,3 +544,32 @@ if_body_return_3: {
"PASS",
]
}
issue_3600: {
options = {
if_return: true,
inline: true,
side_effects: true,
unused: true,
}
input: {
var c = 0;
(function() {
if ([ ][c++]); else return;
return void function() {
var b = --b, a = c = 42;
return c;
}();
})();
console.log(c);
}
expect: {
var c = 0;
(function() {
if ([][c++]) b = --b, c = 42;
var b;
})();
console.log(c);
}
expect_stdout: "1"
}