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).
This commit is contained in:
Alexey Andreev
2016-05-16 13:08:44 +03:00
parent b3d29adad9
commit 05dd039151
27 changed files with 812 additions and 1 deletions
@@ -0,0 +1,16 @@
function box() {
var i;
var sum = 0;
var count = 2;
while (count-- > 0) {
i = 1;
while (i < 10) {
sum += i;
i++
}
}
if (sum != 90) return "fail: " + sum;
return "OK"
}