diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-01 16:18:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-01 16:18:29 +0800 |
commit | aa664dea0a07656d1fa61263e3a03e7d8b5c4cc9 (patch) | |
tree | fad3c0fb8567c8f0f9fed15e4bb276ace522f602 /test/compress/reduce_vars.js | |
parent | 102f994b9d09b3ed0447f02a894fd88fcc903171 (diff) | |
download | tracifyjs-aa664dea0a07656d1fa61263e3a03e7d8b5c4cc9.tar.gz tracifyjs-aa664dea0a07656d1fa61263e3a03e7d8b5c4cc9.zip |
avoid `evaluate` of compound assignment after `dead_code` transform (#2861)
fixes #2860
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r-- | test/compress/reduce_vars.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 2e562f94..761af9e2 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -5467,3 +5467,43 @@ chained_assignments: { } expect_stdout: "5eadbeef" } + +issue_2860_1: { + options = { + dead_code: true, + evaluate: true, + reduce_vars: true, + } + input: { + console.log(function(a) { + return a ^= 1; + a ^= 2; + }()); + } + expect: { + console.log(function(a) { + return 1 ^ a; + }()); + } + expect_stdout: "1" +} + +issue_2860_2: { + options = { + dead_code: true, + evaluate: true, + inline: true, + passes: 2, + reduce_vars: true, + } + input: { + console.log(function(a) { + return a ^= 1; + a ^= 2; + }()); + } + expect: { + console.log(1); + } + expect_stdout: "1" +} |