enhance conditionals (#5542)

This commit is contained in:
Alex Lam S.L
2022-07-07 05:17:23 +01:00
committed by GitHub
parent c8d98f4787
commit d89f0965aa
5 changed files with 554 additions and 62 deletions

View File

@@ -196,6 +196,88 @@ ifs_7: {
}
}
merge_tail_1: {
options = {
conditionals: true,
}
input: {
function f(a) {
var b = "foo";
if (a) {
while (console.log("bar"));
console.log(b);
} else {
while (console.log("baz"));
console.log(b);
}
}
f();
f(42);
}
expect: {
function f(a) {
var b = "foo";
if (a)
while (console.log("bar"));
else
while (console.log("baz"));
console.log(b);
}
f();
f(42);
}
expect_stdout: [
"baz",
"foo",
"bar",
"foo",
]
}
merge_tail_2: {
options = {
conditionals: true,
}
input: {
function f(a) {
var b = "foo";
if (a) {
while (console.log("bar"));
console.log(b);
} else {
c = "baz";
while (console.log(c));
while (console.log("bar"));
console.log(b);
var c;
}
}
f();
f(42);
}
expect: {
function f(a) {
var b = "foo";
if (!a) {
c = "baz";
while (console.log(c));
var c;
}
while (console.log("bar"));
console.log(b);
}
f();
f(42);
}
expect_stdout: [
"baz",
"bar",
"foo",
"bar",
"foo",
]
}
cond_1: {
options = {
conditionals: true,