From 77552d9e6972ece5340db06e6a2501a343702f85 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 1 Feb 2022 11:35:03 +0000 Subject: [PATCH] fix corner case in `inline` (#5329) fixes #5328 --- lib/compress.js | 8 +++++--- test/compress/functions.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/compress.js b/lib/compress.js index e5e65022..6b611b73 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -13170,9 +13170,11 @@ Compressor.prototype.compress = function(node) { scope = scope.parent_scope; } if (!member(scope, compressor.stack)) return; - if (scope instanceof AST_Toplevel && fn.variables.size() > (arrow ? 0 : 1)) { - if (!compressor.toplevel.vars) return; - if (fn.functions.size() > 0 && !compressor.toplevel.funcs) return; + if (scope instanceof AST_Toplevel) { + if (fn.variables.size() > (arrow ? 0 : 1)) { + if (!compressor.toplevel.vars) return; + if (fn.functions.size() > 0 && !compressor.toplevel.funcs) return; + } defined.set("arguments", true); } var async = is_async(fn); diff --git a/test/compress/functions.js b/test/compress/functions.js index 0e55e753..7559755b 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -8134,3 +8134,20 @@ issue_5316_2: { } 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: "" +}