Move coroutineContext to correct package
from kotlin.coroutines.experimental.instrinsics to kotlin.coroutines.experimental #KT-22400
This commit is contained in:
@@ -18,8 +18,9 @@
|
||||
package kotlin.coroutines.experimental
|
||||
|
||||
import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED
|
||||
import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn
|
||||
import kotlin.coroutines.experimental.intrinsics.createCoroutineUnchecked
|
||||
import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn
|
||||
import kotlin.internal.InlineOnly
|
||||
|
||||
/**
|
||||
* Starts coroutine with receiver type [R] and result type [T].
|
||||
@@ -86,13 +87,29 @@ public fun <T> (suspend () -> T).createCoroutine(
|
||||
* from a different thread of execution. Repeated invocation of any resume function produces [IllegalStateException].
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public inline suspend fun <T> suspendCoroutine(crossinline block: (Continuation<T>) -> Unit): T =
|
||||
public suspend inline fun <T> suspendCoroutine(crossinline block: (Continuation<T>) -> Unit): T =
|
||||
suspendCoroutineOrReturn { c: Continuation<T> ->
|
||||
val safe = SafeContinuation(c)
|
||||
block(safe)
|
||||
safe.getResult()
|
||||
}
|
||||
|
||||
/**
|
||||
* Continuation context of current coroutine.
|
||||
*
|
||||
* This allows the user code to not pass an extra [CoroutineContext] parameter in basic coroutine builders
|
||||
* like [launch](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/launch.html)
|
||||
* and [async](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/async.html),
|
||||
* but still provide easy access to coroutine context.
|
||||
*/
|
||||
@SinceKotlin("1.2")
|
||||
@Suppress("WRONG_MODIFIER_TARGET")
|
||||
@InlineOnly
|
||||
public suspend inline val coroutineContext: CoroutineContext
|
||||
get() {
|
||||
throw NotImplementedError("Implemented as intrinsic")
|
||||
}
|
||||
|
||||
// INTERNAL DECLARATIONS
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
|
||||
@@ -40,7 +40,7 @@ import kotlin.coroutines.experimental.*
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.InlineOnly
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
public inline suspend fun <T> suspendCoroutineOrReturn(crossinline block: (Continuation<T>) -> Any?): T =
|
||||
public suspend inline fun <T> suspendCoroutineOrReturn(crossinline block: (Continuation<T>) -> Any?): T =
|
||||
suspendCoroutineUninterceptedOrReturn { cont -> block(cont.intercepted()) }
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ public inline suspend fun <T> suspendCoroutineOrReturn(crossinline block: (Conti
|
||||
*/
|
||||
@SinceKotlin("1.2")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline suspend fun <T> suspendCoroutineUninterceptedOrReturn(crossinline block: (Continuation<T>) -> Any?): T =
|
||||
public suspend inline fun <T> suspendCoroutineUninterceptedOrReturn(crossinline block: (Continuation<T>) -> Any?): T =
|
||||
throw NotImplementedError("Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic")
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,12 @@ public inline fun <T> Continuation<T>.intercepted(): Continuation<T> =
|
||||
*/
|
||||
@SinceKotlin("1.2")
|
||||
@Suppress("WRONG_MODIFIER_TARGET")
|
||||
public inline suspend val coroutineContext: CoroutineContext
|
||||
@Deprecated(
|
||||
"Use kotlin.coroutines.experimental.coroutineContext instead",
|
||||
ReplaceWith("kotlin.coroutines.experimental.coroutineContext"),
|
||||
DeprecationLevel.WARNING
|
||||
)
|
||||
public suspend inline val coroutineContext: CoroutineContext
|
||||
get() {
|
||||
throw NotImplementedError("Implemented as intrinsic")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user