fix corner case in inline (#5402)

fixes #5401
This commit is contained in:
Alex Lam S.L
2022-04-02 18:12:53 +01:00
committed by GitHub
parent 8065e27a7d
commit 224c91b6c1
2 changed files with 26 additions and 0 deletions

View File

@@ -13508,6 +13508,12 @@ Compressor.prototype.compress = function(node) {
def(AST_LabeledStatement, function(compressor, scope, no_return, in_loop) {
var body = this.body.try_inline(compressor, scope, no_return, in_loop);
if (!body) return;
if (this.body instanceof AST_IterationStatement && body instanceof AST_BlockStatement) {
var loop = body.body.pop();
this.body = loop;
body.body.push(this);
return body;
}
this.body = body;
return this;
});

View File

@@ -8350,3 +8350,23 @@ issue_5376_2: {
}
expect_stdout: Error("PASS")
}
issue_5401: {
options = {
inline: true,
}
input: {
L: for (var a in function() {
while (console.log("PASS"));
}(), a) do {
continue L;
} while (console.log("FAIL"));
}
expect: {
while (console.log("PASS"));
L: for (var a in a) do {
continue L;
} while (console.log("FAIL"));
}
expect_stdout: "PASS"
}