fix corner case in if_return (#5689)

fixes #5688
This commit is contained in:
Alex Lam S.L
2022-09-29 23:49:51 +01:00
committed by GitHub
parent e1e3516397
commit 6cdc035b2f
3 changed files with 56 additions and 4 deletions

View File

@@ -126,6 +126,17 @@ function parse_test(file) {
croak(node);
}
var name = node.left.name;
assert.ok([
"beautify",
"expression",
"mangle",
"options",
"rename",
].indexOf(name) >= 0, tmpl("Unsupported setting {name} [{line},{col}]", {
name: name,
line: node.start.line,
col: node.start.col,
}));
test[name] = evaluate(node.right);
return true;
}

View File

@@ -2442,3 +2442,41 @@ issue_5649: {
}
expect_stdout: "PASS"
}
issue_5688: {
options = {
conditionals: true,
if_return: true,
}
input: {
L: do {
switch (console) {
default:
if (console)
break;
if (FAIL_1)
;
else
break L;
break;
case 42:
FAIL_2;
}
} while (console.log("PASS"));
}
expect: {
L: do {
switch (console) {
default:
if (console)
break;
if (FAIL_1)
break;
break L;
case 42:
FAIL_2;
}
} while (console.log("PASS"));
}
expect_stdout: "PASS"
}