diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-04-27 01:54:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 08:54:02 +0800 |
commit | 4cccc01f3ec7f80c4ef3dd574942b164422c6bd9 (patch) | |
tree | 3d82158f8ec33e1245fab07bf81986624c6aaa0b /test | |
parent | 97bd56b7e89c29fe2ba2800f88972e168366ae99 (diff) | |
download | tracifyjs-4cccc01f3ec7f80c4ef3dd574942b164422c6bd9.tar.gz tracifyjs-4cccc01f3ec7f80c4ef3dd574942b164422c6bd9.zip |
fix corner case in `collapse_vars` (#4875)
fixes #4874
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/collapse_vars.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 36cba2a5..071ee162 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -9030,3 +9030,30 @@ issue_4868: { } expect_stdout: "PASS" } + +issue_4874: { + options = { + collapse_vars: true, + evaluate: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a; + a = null; + (function(b) { + for (var c in b = b && b[console.log("PASS")]) + console; + })(a = 42); + } + expect: { + var a; + null; + (function(b) { + for (var c in a && a[console.log("PASS")]) + console; + })(a = 42); + } + expect_stdout: "PASS" +} |