diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-05 17:15:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-05 17:15:37 +0800 |
commit | 067e5a5762cb5da8948ccb9bde4d020decb8d55b (patch) | |
tree | 0f8b2ed3af9083cd1ba6cac123ff9f8e94f3c670 /test/compress/issue-368.js | |
parent | 33b5f3198469f53641172c0702a7f40566325fb0 (diff) | |
download | tracifyjs-067e5a5762cb5da8948ccb9bde4d020decb8d55b.tar.gz tracifyjs-067e5a5762cb5da8948ccb9bde4d020decb8d55b.zip |
fixup for #1553 (#1555)
- `++a` is the one that is foldable
- transform `a++` into `++a` for better optimisation
Diffstat (limited to 'test/compress/issue-368.js')
-rw-r--r-- | test/compress/issue-368.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/compress/issue-368.js b/test/compress/issue-368.js index 8c41a894..5960aa64 100644 --- a/test/compress/issue-368.js +++ b/test/compress/issue-368.js @@ -21,6 +21,16 @@ collapse: { var a; a = b(a / 2); if (a < 0) { + a++; + ++c; + return c / 2; + } + } + function f4(c) { + var a; + a = b(a / 2); + if (a < 0) { + a++; c++; return c / 2; } @@ -35,7 +45,11 @@ collapse: { } function f3(c) { var a; - if ((a = b(a / 2)) < 0) return c++ / 2; + if ((a = b(a / 2)) < 0) return a++, ++c / 2; + } + function f4(c) { + var a; + if ((a = b(a / 2)) < 0) return a++, ++c / 2; } } } |