fix corner case in inline (#5238)

fixes #5237
This commit is contained in:
Alex Lam S.L
2021-12-25 19:30:49 +08:00
committed by GitHub
parent 13d41778b3
commit e1013bd56d
2 changed files with 32 additions and 1 deletions

View File

@@ -12818,7 +12818,6 @@ Compressor.prototype.compress = function(node) {
left: make_node(AST_Number, node, { value: 0 }), left: make_node(AST_Number, node, { value: 0 }),
right: make_node(AST_Number, node, { value: 0 }), right: make_node(AST_Number, node, { value: 0 }),
}); });
if (node instanceof AST_Scope && node !== scope) return node;
})); }));
var body = []; var body = [];
if (fn.rest || !all(fn.argnames, function(argname) { if (fn.rest || !all(fn.argnames, function(argname) {

View File

@@ -7103,3 +7103,35 @@ issue_5230: {
} }
expect_stdout: "42" expect_stdout: "42"
} }
issue_5237: {
options = {
evaluate: true,
inline: true,
}
input: {
function f() {
(function() {
while (console.log(0/0));
})();
(function() {
var NaN = console && console.log(NaN);
})();
}
f();
}
expect: {
function f() {
(function() {
while (console.log(0/0));
})();
var NaN = console && console.log(NaN);
return;
}
f();
}
expect_stdout: [
"NaN",
"undefined",
]
}