From 74396acc86a3d36dda2db43a007aa93f40cf58f8 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Wed, 11 Dec 2019 06:39:46 +0800 Subject: fix corner case in `loops` (#3635) fixes #3634 --- test/compress/loops.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test') 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" +} -- cgit v1.2.3