[JS IR] Update coroutine runtime
This commit is contained in:
@@ -27,9 +27,7 @@ import kotlin.internal.InlineOnly
|
|||||||
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 a = this.asDynamic()
|
return this.asDynamic()(completion)
|
||||||
return if (jsTypeOf(a) == "function") a(completion, false)
|
|
||||||
else a.invoke(completion)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,9 +48,7 @@ public actual inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedO
|
|||||||
receiver: R,
|
receiver: R,
|
||||||
completion: Continuation<T>
|
completion: Continuation<T>
|
||||||
): Any? {
|
): Any? {
|
||||||
val a = this.asDynamic()
|
return this.asDynamic()(receiver, completion)
|
||||||
return if(jsTypeOf(a) == "function") a(receiver, completion, false)
|
|
||||||
else a.invoke_P1(receiver, completion)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -76,19 +72,8 @@ public actual inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedO
|
|||||||
public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
|
public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
|
||||||
completion: Continuation<T>
|
completion: Continuation<T>
|
||||||
): Continuation<Unit> =
|
): Continuation<Unit> =
|
||||||
// Kotlin/JS suspend lambdas have an extra parameter `suspended`
|
createCoroutineFromSuspendFunction(completion) {
|
||||||
if (this.asDynamic().length == 2) {
|
this.asDynamic()(completion)
|
||||||
// When `suspended` is true the continuation is created, but not executed
|
|
||||||
this.asDynamic()(completion, true)
|
|
||||||
} else {
|
|
||||||
createCoroutineFromSuspendFunction(completion) {
|
|
||||||
val a = this.asDynamic()
|
|
||||||
if (jsTypeOf(a) == "function") {
|
|
||||||
a(completion)
|
|
||||||
} else {
|
|
||||||
a.invoke(completion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,19 +97,8 @@ public actual fun <R, T> (suspend R.() -> T).createCoroutineUnintercepted(
|
|||||||
receiver: R,
|
receiver: R,
|
||||||
completion: Continuation<T>
|
completion: Continuation<T>
|
||||||
): Continuation<Unit> =
|
): Continuation<Unit> =
|
||||||
// Kotlin/JS suspend lambdas have an extra parameter `suspended`
|
createCoroutineFromSuspendFunction(completion) {
|
||||||
if (this.asDynamic().length == 3) {
|
this.asDynamic()(receiver, completion)
|
||||||
// When `suspended` is true the continuation is created, but not executed
|
|
||||||
this.asDynamic()(receiver, completion, true)
|
|
||||||
} else {
|
|
||||||
createCoroutineFromSuspendFunction(completion) {
|
|
||||||
val a = this.asDynamic()
|
|
||||||
if (jsTypeOf(a) == "function") {
|
|
||||||
a(receiver, completion)
|
|
||||||
} else {
|
|
||||||
a.invoke_P1(receiver, completion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user