KT-12275 Add JS optimization that transforms the following code

```
do {
    guard: {
        // do something
        break guard;
        // do something
    }
} while (condition)
```

to

```
do {
    // do something
    continue;
    // do something
} while (condition)
```
This commit is contained in:
Alexey Andreev
2016-05-13 19:06:17 +03:00
parent 1a61115148
commit b3d29adad9
10 changed files with 322 additions and 1 deletions
@@ -0,0 +1,20 @@
function box() {
var i = 0;
var counter = 0;
var sum = 0;
loop: do {
i++;
if (i < 5) {
for (var j = 0; j < 10; ++j) {
counter += j;
if (j == 3 && i == 2) continue loop;
}
}
sum += i;
} while (i < 10);
if (sum != 53) return "fail1: " + sum;
if (counter != 141) return "fail2: " + counter;
return "OK";
}