Files
kotlin/compiler/testData/codegen/bytecodeText/constCoroutine.kt
Denis Zharkov d0ba048342 Refine coroutine/suspend functions ABI
- `invoke` method must always start a suspend functions
- For creation of coroutine that has not been started yet, there are
two special internal interfaces `SuspendFunction0`/`SuspendFunction1`
2016-12-22 11:08:42 +03:00

26 lines
545 B
Kotlin
Vendored

// WITH_RUNTIME
// WITH_COROUTINES
// TREAT_AS_ONE_FILE
import kotlin.coroutines.*
suspend fun suspendHere() = ""
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
for (i in 1..3) {
builder {
if (suspendHere() != "OK") throw java.lang.RuntimeException("fail 1")
}
}
return "OK"
}
// 2 GETSTATIC kotlin/Unit.INSTANCE : Lkotlin/Unit;
// 1 GETSTATIC EmptyContinuation.INSTANCE
// 2 GETSTATIC kotlin/coroutines/CoroutineIntrinsics.INSTANCE
// 5 GETSTATIC