Files
kotlin-fork/js/js.translator/testData/js-optimizer/while-condition-folding/inNestedLoop.original.js
T
Alexey Andreev 05dd039151 KT-12275 Add JS optimization that transforms the following code
```
do {
    X
    if (B) break;
} while (A)
```

to

```
do {
    X
} while (!B && A)
```

Add inversion that takes boolean expression and applies negation to it, simplifying if possible (like !!a => a).
2016-07-25 18:46:46 +03:00

19 lines
307 B
JavaScript
Vendored

function box() {
var i;
var sum = 0;
var count = 2;
while (count-- > 0) {
i = 1;
while (true) {
if (i >= 10) {
break;
}
sum += i;
i++
}
}
if (sum != 90) return "fail: " + sum;
return "OK"
}