diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-12-17 16:55:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-18 00:55:19 +0800 |
commit | 02fdcfde01cf41cae9449dbde4ceb74564bb35f3 (patch) | |
tree | ed03d7d9146ea280332af13f676bc31a1b492186 /lib | |
parent | a96f087ac33b6d18d5ffa3cacd39dd693defb7cf (diff) | |
download | tracifyjs-02fdcfde01cf41cae9449dbde4ceb74564bb35f3.tar.gz tracifyjs-02fdcfde01cf41cae9449dbde4ceb74564bb35f3.zip |
fix corner case in `inline` (#4389)
fixes #4388
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js index ffc19b25..2c50cb37 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -8026,8 +8026,14 @@ merge(Compressor.prototype, { })); if (found) return false; } - var safe_to_inject = (!(scope instanceof AST_Toplevel) || compressor.toplevel.vars) - && (exp !== fn || fn.parent_scope.resolve() === scope); + var safe_to_inject = exp !== fn || fn.parent_scope.resolve() === scope; + if (scope instanceof AST_Toplevel) { + if (compressor.toplevel.vars) { + defined["arguments"] = true; + } else { + safe_to_inject = false; + } + } var inline = compressor.option("inline"); var used = Object.create(defined); if (!can_inject_args(defined, used, inline >= 2 && safe_to_inject)) return false; |