From 9697196473def1c11e1fab61fdca23b6cc9e5d38 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Fri, 3 Feb 2017 14:15:38 +0300 Subject: [PATCH] Put startCoroutineUninterceptedOrReturn header to common stdlib --- .../src/kotlin/CoroutinesIntrinsicsH.kt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libraries/stdlib/common/src/kotlin/CoroutinesIntrinsicsH.kt b/libraries/stdlib/common/src/kotlin/CoroutinesIntrinsicsH.kt index 4a4b24240ca..0cc510533eb 100644 --- a/libraries/stdlib/common/src/kotlin/CoroutinesIntrinsicsH.kt +++ b/libraries/stdlib/common/src/kotlin/CoroutinesIntrinsicsH.kt @@ -18,6 +18,31 @@ package kotlin.coroutines.experimental.intrinsics import kotlin.coroutines.experimental.Continuation +/** + * Starts unintercepted coroutine without receiver and with result type [T] and executes it until its first suspension. + * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. + * In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. + * This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of suspended + * coroutine using a reference to the suspending function. + */ +@SinceKotlin("1.1") +public header inline fun (suspend () -> T).startCoroutineUninterceptedOrReturn( + completion: Continuation +): Any? + +/** + * Starts unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension. + * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends. + * In the later case, the [completion] continuation is invoked when coroutine completes with result or exception. + * This function is designed to be used from inside of [suspendCoroutineOrReturn] to resume the execution of suspended + * coroutine using a reference to the suspending function. + */ +@SinceKotlin("1.1") +public header inline fun (suspend R.() -> T).startCoroutineUninterceptedOrReturn( + receiver: R, + completion: Continuation +): Any? + @SinceKotlin("1.1") public header fun (suspend () -> T).createCoroutineUnchecked( completion: Continuation