fix corner case in inline (#5257)

fixes #5256
This commit is contained in:
Alex Lam S.L
2022-01-03 02:13:29 +00:00
committed by GitHub
parent 7889192cae
commit 1a054e869e
2 changed files with 22 additions and 3 deletions

View File

@@ -12937,9 +12937,7 @@ Compressor.prototype.compress = function(node) {
if (!fn.variables.all(function(def, name) {
if (in_loop) in_loop.push(def);
if (!defined.has(name) && !names.has(name)) return true;
if (name != "arguments") return false;
if (scope.uses_arguments) return false;
return def.references.length == def.replaced;
return !arrow && name == "arguments" && def.orig.length == 1;
})) return;
if (in_loop && in_loop.length > 0 && is_reachable(fn, in_loop)) return;
var simple_argnames = true;

View File

@@ -2092,3 +2092,24 @@ issue_5246_3: {
expect_stdout: "undefined"
node_version: ">=6"
}
issue_5256: {
options = {
inline: true,
}
input: {
(function(arguments = console.log) {
console;
})();
console.log(typeof arguments);
}
expect: {
// Syntax error on Node.js v6
(function(arguments = console.log) {
console;
})();
console.log(typeof arguments);
}
expect_stdout: "undefined"
node_version: ">=8"
}