fix corner case in inline (#5329)

fixes #5328
This commit is contained in:
Alex Lam S.L
2022-02-01 11:35:03 +00:00
committed by GitHub
parent 93105f1a6d
commit 77552d9e69
2 changed files with 22 additions and 3 deletions

View File

@@ -13170,9 +13170,11 @@ Compressor.prototype.compress = function(node) {
scope = scope.parent_scope; scope = scope.parent_scope;
} }
if (!member(scope, compressor.stack)) return; if (!member(scope, compressor.stack)) return;
if (scope instanceof AST_Toplevel && fn.variables.size() > (arrow ? 0 : 1)) { if (scope instanceof AST_Toplevel) {
if (!compressor.toplevel.vars) return; if (fn.variables.size() > (arrow ? 0 : 1)) {
if (fn.functions.size() > 0 && !compressor.toplevel.funcs) return; if (!compressor.toplevel.vars) return;
if (fn.functions.size() > 0 && !compressor.toplevel.funcs) return;
}
defined.set("arguments", true); defined.set("arguments", true);
} }
var async = is_async(fn); var async = is_async(fn);

View File

@@ -8134,3 +8134,20 @@ issue_5316_2: {
} }
expect_stdout: "PASS" expect_stdout: "PASS"
} }
issue_5328: {
options = {
inline: true,
}
input: {
(function(arguments) {
console.log(Object.keys(arguments).join());
})(this);
}
expect: {
(function(arguments) {
console.log(Object.keys(arguments).join());
})(this);
}
expect_stdout: ""
}