diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-10-12 12:03:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 19:03:21 +0800 |
commit | 00d0eda85baba441e8aaac056b6f32b12e79dd6e (patch) | |
tree | 02b42cd075fc61ff881ae69a55e46f7d20f43d71 | |
parent | 1cdf810f0bc7dfbbdadedd1274e990c46e6e59b8 (diff) | |
download | tracifyjs-00d0eda85baba441e8aaac056b6f32b12e79dd6e.tar.gz tracifyjs-00d0eda85baba441e8aaac056b6f32b12e79dd6e.zip |
fix corner case in `arguments` (#4201)
fixes #4200
-rw-r--r-- | lib/compress.js | 1 | ||||
-rw-r--r-- | test/compress/arguments.js | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index f930dd82..3464a232 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -9180,6 +9180,7 @@ merge(Compressor.prototype, { var i = 0, p; while (p = compressor.parent(i++)) { if (p instanceof AST_Lambda) { + if (p instanceof AST_Accessor) return; fn_parent = compressor.parent(i); return p; } diff --git a/test/compress/arguments.js b/test/compress/arguments.js index dc00eefe..a835aef8 100644 --- a/test/compress/arguments.js +++ b/test/compress/arguments.js @@ -783,3 +783,27 @@ issue_3420_7: { } expect_stdout: "true" } + +issue_4200: { + options = { + arguments: true, + keep_fargs: false, + } + input: { + var o = { + get p() { + return arguments[0]; + }, + }; + console.log(o.p); + } + expect: { + var o = { + get p() { + return arguments[0]; + }, + }; + console.log(o.p); + } + expect_stdout: "undefined" +} |