diff options
author | Richard van Velzen <rvanvelzen1@gmail.com> | 2015-02-11 21:05:49 +0100 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2015-02-11 21:08:41 +0100 |
commit | 992b6b9fcce47ca67ecb14675f10b172ce7a99b5 (patch) | |
tree | 1a9dd765655e5af97392fae25dcb285462cf8aa7 /test/compress/issue-637.js | |
parent | 7b7134405118e944f87772edc41c3ddec856cdff (diff) | |
download | tracifyjs-992b6b9fcce47ca67ecb14675f10b172ce7a99b5.tar.gz tracifyjs-992b6b9fcce47ca67ecb14675f10b172ce7a99b5.zip |
Fix invalid removal of left side in && and || compression
See #637. This does not produce the optimal result, but it does prevent the removal of non-side-effect-free code.
Diffstat (limited to 'test/compress/issue-637.js')
-rw-r--r-- | test/compress/issue-637.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/compress/issue-637.js b/test/compress/issue-637.js new file mode 100644 index 00000000..45fd2481 --- /dev/null +++ b/test/compress/issue-637.js @@ -0,0 +1,22 @@ +wrongly_optimized: { + options = { + conditionals: true, + booleans: true, + evaluate: true + }; + input: { + function func() { + foo(); + } + if (func() || true) { + bar(); + } + } + expect: { + function func() { + foo(); + } + // TODO: optimize to `func(), bar()` + (func(), 0) || bar(); + } +} |