diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-09-22 13:08:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 20:08:45 +0800 |
commit | 3472cf1a908f516d1f2dd69b773abc61d7019b44 (patch) | |
tree | 2b8dc719fb16781fcfcd798a7216e4bb0af5d098 /test | |
parent | 6d4c0fa6fabd7c5c75be419ed166b326f3da6bf3 (diff) | |
download | tracifyjs-3472cf1a908f516d1f2dd69b773abc61d7019b44.tar.gz tracifyjs-3472cf1a908f516d1f2dd69b773abc61d7019b44.zip |
fix corner case in `unused` (#4147)
fixes #4146
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/drop-unused.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index 219adc9e..0b76f6f6 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -2965,3 +2965,30 @@ issue_4144: { } expect_stdout: "PASS" } + +issue_4146: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + function f(a, b) { + function g() {} + var a = g; + var c = b; + c.p; + console.log(typeof a); + } + f("FAIL", 42); + } + expect: { + (function(a, b) { + a = function () {}; + var c = b; + c.p; + console.log(typeof a); + })(0, 42); + } + expect_stdout: "function" +} |