From f7841bc8b8bd6a415b9cf250da66c97c75c7bb70 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 2 Jan 2022 08:10:39 +0000 Subject: [PATCH] fix corner case in `inline` (#5253) fixes #5251 --- lib/compress.js | 1 + test/compress/arrows.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/compress.js b/lib/compress.js index 1df3bb76..2e38368c 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -12925,6 +12925,7 @@ Compressor.prototype.compress = function(node) { 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; + defined.set("arguments", true); } var async = is_async(fn); if (async && !(compressor.option("awaits") && is_async(scope))) return; diff --git a/test/compress/arrows.js b/test/compress/arrows.js index 709fc638..cc8b7072 100644 --- a/test/compress/arrows.js +++ b/test/compress/arrows.js @@ -906,3 +906,24 @@ issue_4772: { expect_stdout: "PASS" node_version: ">=4" } + +issue_5251: { + options = { + inline: true, + toplevel: true, + } + input: { + (() => { + while (console.log(arguments)) + var arguments = "FAIL"; + })(); + } + expect: { + (() => { + while (console.log(arguments)) + var arguments = "FAIL"; + })(); + } + expect_stdout: true + node_version: ">=4" +}