diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-07-24 00:10:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-24 07:10:14 +0800 |
commit | 657d525c80e611df9a78812e4b6a35a3eb24d8f4 (patch) | |
tree | 011d38b8dc62992972f61270915e62fece469e7c /test | |
parent | 6a3fe9d1dfd3ec4543dc71b72e990bed2c6022ef (diff) | |
download | tracifyjs-657d525c80e611df9a78812e4b6a35a3eb24d8f4.tar.gz tracifyjs-657d525c80e611df9a78812e4b6a35a3eb24d8f4.zip |
fix corner case in `reduce_vars` (#5099)
fixes #5098
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/functions.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index ff727da4..ccfb3044 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -6535,3 +6535,33 @@ issue_5096_4: { } expect_stdout: "PASS" } + +issue_5098: { + options = { + reduce_vars: true, + unused: true, + } + input: { + (function(o) { + function f() { + f = console.log; + if (o.p++) + throw "FAIL"; + f("PASS"); + } + return f; + })({ p: 0 })(); + } + expect: { + (function(o) { + function f() { + f = console.log; + if (o.p++) + throw "FAIL"; + f("PASS"); + } + return f; + })({ p: 0 })(); + } + expect_stdout: "PASS" +} |