[K/N] Follow-up for the fix for #KT-55869
This commit is contained in:
+12
-18
@@ -26,14 +26,12 @@ import kotlin.native.internal.*
|
|||||||
public actual inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrReturn(
|
public actual inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrReturn(
|
||||||
completion: Continuation<T>
|
completion: Continuation<T>
|
||||||
): Any? {
|
): Any? {
|
||||||
|
val wrappedCompletion = wrapWithContinuationImpl(completion)
|
||||||
val function = this as? Function1<Continuation<T>, Any?>
|
val function = this as? Function1<Continuation<T>, Any?>
|
||||||
return if (function == null)
|
return if (function == null)
|
||||||
startCoroutineUninterceptedOrReturnFallback(this, completion)
|
startCoroutineUninterceptedOrReturnFallback(this, wrappedCompletion)
|
||||||
else {
|
else
|
||||||
function.invoke(
|
function.invoke(wrappedCompletion)
|
||||||
completion.takeIf { this is BaseContinuationImpl } ?: wrapWithContinuationImpl(completion)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
@@ -66,14 +64,12 @@ public actual inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedO
|
|||||||
receiver: R,
|
receiver: R,
|
||||||
completion: Continuation<T>
|
completion: Continuation<T>
|
||||||
): Any? {
|
): Any? {
|
||||||
|
val wrappedCompletion = wrapWithContinuationImpl(completion)
|
||||||
val function = this as? Function2<R, Continuation<T>, Any?>
|
val function = this as? Function2<R, Continuation<T>, Any?>
|
||||||
return if (function == null)
|
return if (function == null)
|
||||||
startCoroutineUninterceptedOrReturnFallback(this, receiver, completion)
|
startCoroutineUninterceptedOrReturnFallback(this, receiver, wrappedCompletion)
|
||||||
else {
|
else
|
||||||
function.invoke(receiver,
|
function.invoke(receiver, wrappedCompletion)
|
||||||
completion.takeIf { this is BaseContinuationImpl } ?: wrapWithContinuationImpl(completion)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
@@ -96,14 +92,12 @@ internal actual inline fun <R, P, T> (suspend R.(P) -> T).startCoroutineUninterc
|
|||||||
param: P,
|
param: P,
|
||||||
completion: Continuation<T>
|
completion: Continuation<T>
|
||||||
): Any? {
|
): Any? {
|
||||||
|
val wrappedCompletion = wrapWithContinuationImpl(completion)
|
||||||
val function = this as? Function3<R, P, Continuation<T>, Any?>
|
val function = this as? Function3<R, P, Continuation<T>, Any?>
|
||||||
return if (function == null)
|
return if (function == null)
|
||||||
startCoroutineUninterceptedOrReturnFallback(this, receiver, param, completion)
|
startCoroutineUninterceptedOrReturnFallback(this, receiver, param, wrappedCompletion)
|
||||||
else {
|
else
|
||||||
function.invoke(receiver, param,
|
function.invoke(receiver, param, wrappedCompletion)
|
||||||
completion.takeIf { this is BaseContinuationImpl } ?: wrapWithContinuationImpl(completion)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
|||||||
Reference in New Issue
Block a user