mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
FixStack transformation divides on phases: - Fixing stack before break/continue - Fixing stack for inline markers/try-catch blocks After the first stage all ALWAYS_TRUE markers are replaced with simple GOTO's and if we're skipping break/continue edges we won't reach the code after while (true) statement. At the same time it's fine to not to skip them in the second phase as the stack for them is already corrected in the first phase #KT-19475 Fixed
19 lines
304 B
Kotlin
Vendored
19 lines
304 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
fun box(): String {
|
|
val a = arrayListOf<String>()
|
|
|
|
while (true) {
|
|
if (a.size == 0) {
|
|
break
|
|
}
|
|
}
|
|
|
|
for (i in 1..2) {
|
|
a.add(try { foo() } catch (e: Throwable) { "OK" })
|
|
}
|
|
|
|
return a[0]
|
|
}
|
|
|
|
fun foo(): String = throw RuntimeException()
|