enhance join_vars (#3804)

This commit is contained in:
Alex Lam S.L
2020-04-19 23:37:46 +01:00
committed by GitHub
parent e38754e802
commit 88504ab869
3 changed files with 106 additions and 12 deletions

View File

@@ -22,8 +22,7 @@ issue_1639_1: {
console.log(a, b);
}
expect: {
for (var a = 100, b = 10, L1 = 5; --L1 > 0;) {
var ignore;
for (var a = 100, b = 10, L1 = 5, ignore; --L1 > 0;) {
--b;
}
console.log(a, b);

View File

@@ -815,3 +815,84 @@ issue_3795: {
}
expect_stdout: "PASS"
}
if_body: {
options = {
join_vars: true,
}
input: {
var a;
if (x)
var b;
else
var c;
}
expect: {
var a, b, c;
if (x);
else;
}
}
if_switch: {
options = {
join_vars: true,
}
input: {
var a;
if (x) switch (y) {
case 1:
var b;
default:
var c;
}
}
expect: {
var a, b, c;
if (x) switch (y) {
case 1:
default:
}
}
}
loop_body_1: {
options = {
join_vars: true,
}
input: {
var a;
for (;x;)
var b;
}
expect: {
for (var a, b; x;);
}
}
loop_body_2: {
options = {
join_vars: true,
}
input: {
for (var a; x;)
var b;
}
expect: {
for (var a, b; x;);
}
}
loop_body_3: {
options = {
join_vars: true,
}
input: {
var a;
for (var b; x;)
var c;
}
expect: {
for (var a, b, c; x;);
}
}