enhance if_return (#5326)

This commit is contained in:
Alex Lam S.L
2022-01-30 22:32:25 +00:00
committed by GitHub
parent 0a5a1f3687
commit d7eb80b050
2 changed files with 82 additions and 7 deletions

View File

@@ -327,7 +327,7 @@ issue_512: {
}
}
if_var_return: {
if_var_return_1: {
options = {
conditionals: true,
if_return: true,
@@ -373,6 +373,52 @@ if_var_return: {
}
}
if_var_return_2: {
options = {
conditionals: true,
if_return: true,
sequences: true,
}
input: {
(function() {
var a = w();
if (x())
return y();
z();
})();
}
expect: {
(function() {
var a = w();
return x() ? y() : (z(), void 0);
})();
}
}
if_var_return_3: {
options = {
conditionals: true,
if_return: true,
sequences: true,
}
input: {
function f() {
if (u())
return v();
var a = w();
if (x())
return y();
z();
}
}
expect: {
function f() {
return u() ? v() : (a = w(), x() ? y() : (z(), void 0));
var a;
}
}
}
if_if_return_return: {
options = {
conditionals: true,