diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-04-04 23:48:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-04 23:48:22 +0800 |
commit | 9b6bc67c3393507d0621eb3debbe8845b0eff52d (patch) | |
tree | 9e696d86f097bbb9dededf8808b61342d2133748 /test | |
parent | 4b90dc1fdb30274a7f1c2d38493fd31d6a553982 (diff) | |
download | tracifyjs-9b6bc67c3393507d0621eb3debbe8845b0eff52d.tar.gz tracifyjs-9b6bc67c3393507d0621eb3debbe8845b0eff52d.zip |
optimise `do{...}while(false)` (#1785)
- better heuristics to avoid issues like #1532
- fix `TreeWalker.loopcontrol_target()`
- `continue` cannot refer to `switch` blocks
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/loops.js | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/test/compress/loops.js b/test/compress/loops.js index c8d77840..f13f5cc5 100644 --- a/test/compress/loops.js +++ b/test/compress/loops.js @@ -215,8 +215,7 @@ evaluate: { a(); for(;;) c(); - // rule disabled due to issue_1532 - do d(); while (false); + d(); } } @@ -458,3 +457,26 @@ issue_1648: { } expect_exact: "function f(){for(x();1;);}" } + +do_switch: { + options = { + evaluate: true, + loops: true, + } + input: { + do { + switch (a) { + case b: + continue; + } + } while (false); + } + expect: { + do { + switch (a) { + case b: + continue; + } + } while (false); + } +} |