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,27 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.js.test.optimizer
import org.junit.Test
class DoWhileGuardEliminationTest : BasicOptimizerTest("do-while-guard-elimination") {
@Test fun simple() = box()
@Test fun innerContinue() = box()
@Test fun innerBreakInLoopWithoutLabel() = box()
}