diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-12-24 19:58:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-25 03:58:23 +0800 |
commit | dfc3ec9cef2f8dad08471cf636f52387045b342d (patch) | |
tree | 5140fcabff6cb1ebd3b2cf886a35fb1385fbd9d7 | |
parent | 18966945324786d29def134662221a068297161d (diff) | |
download | tracifyjs-dfc3ec9cef2f8dad08471cf636f52387045b342d.tar.gz tracifyjs-dfc3ec9cef2f8dad08471cf636f52387045b342d.zip |
fix corner case in `pure_getters` (#4449)
fixes #4448
-rw-r--r-- | lib/compress.js | 1 | ||||
-rw-r--r-- | test/compress/arrows.js | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index 29cd26b6..2c1f87d1 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -358,6 +358,7 @@ merge(Compressor.prototype, { function is_arguments(def) { if (def.name != "arguments") return false; + if (!def.scope.uses_arguments) return false; var orig = def.orig; return orig.length == 1 && orig[0] instanceof AST_SymbolFunarg; } diff --git a/test/compress/arrows.js b/test/compress/arrows.js index cc5aec5f..990090b2 100644 --- a/test/compress/arrows.js +++ b/test/compress/arrows.js @@ -587,3 +587,32 @@ issue_4401: { ] node_version: ">=4" } + +issue_4448: { + options = { + pure_getters: "strict", + side_effects: true, + } + input: { + var A; + try { + (arguments => { + arguments[0]; + })(A); + } catch (e) { + console.log("PASS"); + } + } + expect: { + var A; + try { + (arguments => { + arguments[0]; + })(A); + } catch (e) { + console.log("PASS"); + } + } + expect_stdout: "PASS" + node_version: ">=4" +} |