diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-06-05 11:51:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-05 18:51:21 +0800 |
commit | eb481cee8cebcb0bee778827cab6d625e5cb30b8 (patch) | |
tree | 3bbc3618621b28d32146b4617ede0f3414c50823 /test/compress/drop-unused.js | |
parent | fbc9d8009bee522fe784602ba8b157a38a45bd69 (diff) | |
download | tracifyjs-eb481cee8cebcb0bee778827cab6d625e5cb30b8.tar.gz tracifyjs-eb481cee8cebcb0bee778827cab6d625e5cb30b8.zip |
fix corner cases in `reduce_vars` & `unused` (#3955)
fixes #3953
fixes #3956
fixes #3957
Diffstat (limited to 'test/compress/drop-unused.js')
-rw-r--r-- | test/compress/drop-unused.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index f3aeab21..a4a8595b 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -2652,3 +2652,41 @@ issue_3951: { "0", ] } + +issue_3956: { + options = { + collapse_vars: true, + evaluate: true, + inline: true, + passes: 2, + reduce_vars: true, + sequences: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + (function(a) { + function f(b) { + console.log(b); + a = 1; + } + var c = f(c += 0); + (function(d) { + console.log(d); + })(console.log(a) ^ 1, c); + })(); + } + expect: { + var c, d; + c += 0, + console.log(NaN), + d = 1 ^ console.log(1), + console.log(d); + } + expect_stdout: [ + "NaN", + "1", + "1", + ] +} |