diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-12-11 06:39:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-11 06:39:46 +0800 |
commit | 74396acc86a3d36dda2db43a007aa93f40cf58f8 (patch) | |
tree | 2fcdb86957df033c1648734d1b136392c01cf42d /test | |
parent | 036bca980caad83edbabca860c69515d8007bd11 (diff) | |
download | tracifyjs-74396acc86a3d36dda2db43a007aa93f40cf58f8.tar.gz tracifyjs-74396acc86a3d36dda2db43a007aa93f40cf58f8.zip |
fix corner case in `loops` (#3635)
fixes #3634
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/loops.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/compress/loops.js b/test/compress/loops.js index 5f3b927d..db0fbb9a 100644 --- a/test/compress/loops.js +++ b/test/compress/loops.js @@ -879,3 +879,51 @@ loop_return: { } expect_stdout: "foo 42" } + +issue_3634_1: { + options = { + loops: true, + } + input: { + var b = 0; + L: while (++b < 2) + while (1) + if (b) break L; + console.log(b); + } + expect: { + var b = 0; + L: for (;++b < 2;) + for (;1;) + if (b) break L; + console.log(b); + } + expect_stdout: "1" +} + +issue_3634_2: { + options = { + loops: true, + } + input: { + var b = 0; + L: while (++b < 2) + while (1) + if (!b) + continue L; + else + break L; + console.log(b); + } + expect: { + var b = 0; + L: for (;++b < 2;) + for (;1;) + if (!b) + continue L; + else + break L; + console.log(b); + } + expect_stdout: "1" +} |