diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-26 13:32:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-26 13:32:43 +0800 |
commit | 94f84727ce454c3ecf5206ac79dba4a21ec6deb6 (patch) | |
tree | 6f62d268cc989bd842159958dae92e9fca78171e /test | |
parent | 8a4f86528f5b5c3a0ee0a709ed3a6b908706a5c3 (diff) | |
download | tracifyjs-94f84727ce454c3ecf5206ac79dba4a21ec6deb6.tar.gz tracifyjs-94f84727ce454c3ecf5206ac79dba4a21ec6deb6.zip |
suppress switch branch de-duplication upon side effects (#1682)
fixes #1679
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/switch.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/compress/switch.js b/test/compress/switch.js index 7d3d7d13..481257aa 100644 --- a/test/compress/switch.js +++ b/test/compress/switch.js @@ -434,3 +434,50 @@ issue_1674: { } expect_stdout: "PASS" } + +issue_1679: { + options = { + dead_code: true, + evaluate: true, + } + input: { + var a = 100, b = 10; + function f() { + switch (--b) { + default: + case !function x() {}: + break; + case b--: + switch (0) { + default: + case a--: + } + break; + case (a++): + break; + } + } + f(); + console.log(a, b); + } + expect: { + var a = 100, b = 10; + function f() { + switch (--b) { + default: + case !function x() {}: + break; + case b--: + switch (0) { + default: + case a--: + } + break; + case (a++): + } + } + f(); + console.log(a, b); + } + expect_stdout: true +} |