Global rename in test data for coroutines
(cherry picked from commit 132f97b)
This commit is contained in:
committed by
Stanislav Erokhin
parent
8968bc3dd6
commit
b527a4d158
+2
-2
@@ -54,7 +54,7 @@ private var log = ""
|
||||
|
||||
private var inAwait = false
|
||||
|
||||
suspend fun <S> await(value: Promise<S>): S = suspendWithCurrentContinuation { continuation: Continuation<S> ->
|
||||
suspend fun <S> await(value: Promise<S>): S = CoroutineIntrinsics.suspendCoroutineOrReturn { continuation: Continuation<S> ->
|
||||
if (inAwait) {
|
||||
throw IllegalStateException("Can't call await recursively")
|
||||
}
|
||||
@@ -65,7 +65,7 @@ suspend fun <S> await(value: Promise<S>): S = suspendWithCurrentContinuation { c
|
||||
}
|
||||
}
|
||||
inAwait = false
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun <S> awaitAndLog(value: Promise<S>): S {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x -> }
|
||||
suspend fun suspendHere(): Any = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> }
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
var exception: Throwable? = null
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x ->}
|
||||
suspend fun suspendHere(): Any = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
try {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
|
||||
suspend fun <T> await(t: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> await(t: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
c.resume(t)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit): String {
|
||||
|
||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendAndLog(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
result += "suspend($value);"
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
result += "["
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,17 +6,17 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendAndLog(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
result += "suspend($value);"
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
// Tail calls are not allowed to be Nothing typed. See KT-15051
|
||||
suspend fun suspendLogAndThrow(exception: Throwable): Any? = suspendWithCurrentContinuation { c ->
|
||||
suspend fun suspendLogAndThrow(exception: Throwable): Any? = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
result += "throw(${exception.message});"
|
||||
c.resumeWithException(exception)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendAndLog(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
result += "suspend($value);"
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
|
||||
suspend fun <T> suspendWithResult(value: T): T = suspendWithCurrentContinuation { c ->
|
||||
suspend fun <T> suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
|
||||
c.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
var result = false
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(a: String = "abc", i: Int = 2): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(a: String = "abc", i: Int = 2): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(a + "#" + (i + 1))
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -6,38 +6,38 @@ class Controller {
|
||||
var log = ""
|
||||
var resumeIndex = 0
|
||||
|
||||
suspend fun <T> suspendWithValue(value: T): T = suspendWithCurrentContinuation { continuation ->
|
||||
suspend fun <T> suspendWithValue(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { continuation ->
|
||||
log += "suspend($value);"
|
||||
continuation.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithException(value: String): Unit = suspendWithCurrentContinuation { continuation ->
|
||||
suspend fun suspendWithException(value: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { continuation ->
|
||||
log += "error($value);"
|
||||
continuation.resumeWithException(RuntimeException(value))
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
fun test(c: suspend Controller.() -> Unit): String {
|
||||
val controller = Controller()
|
||||
c.startCoroutine(controller, EmptyContinuation, object: ResumeInterceptor {
|
||||
private fun interceptResume(block: () -> Unit) {
|
||||
c.startCoroutine(controller, EmptyContinuation, object: ContinuationDispatcher {
|
||||
private fun dispatchResume(block: () -> Unit) {
|
||||
val id = controller.resumeIndex++
|
||||
controller.log += "before $id;"
|
||||
block()
|
||||
controller.log += "after $id;"
|
||||
}
|
||||
|
||||
override fun <P> interceptResume(data: P, continuation: Continuation<P>): Boolean {
|
||||
interceptResume {
|
||||
override fun <P> dispatchResume(data: P, continuation: Continuation<P>): Boolean {
|
||||
dispatchResume {
|
||||
continuation.resume(data)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun interceptResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean {
|
||||
interceptResume {
|
||||
override fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean {
|
||||
dispatchResume {
|
||||
continuation.resumeWithException(exception)
|
||||
}
|
||||
return true
|
||||
@@ -5,10 +5,10 @@ import kotlin.coroutines.*
|
||||
var result = 0
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
result++
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun <T> suspendHere(v: T): T = suspendWithCurrentContinuation { x ->
|
||||
suspend fun <T> suspendHere(v: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -50,10 +50,10 @@ class GeneratedIterator<T>(block: suspend Generator<T>.() -> Unit) : AbstractIte
|
||||
override fun computeNext() {
|
||||
nextStep.resume(Unit)
|
||||
}
|
||||
suspend override fun yield(value: T) = suspendWithCurrentContinuation<Unit> { c ->
|
||||
suspend override fun yield(value: T) = CoroutineIntrinsics.suspendCoroutineOrReturn<Unit> { c ->
|
||||
setNext(value)
|
||||
nextStep = c
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,20 +6,20 @@ class Controller {
|
||||
var exception: Throwable? = null
|
||||
val postponedActions = ArrayList<() -> Unit>()
|
||||
|
||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resume(v)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resumeWithException(e)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun run(c: suspend Controller.() -> Unit) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
@@ -5,10 +5,10 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var log = ""
|
||||
|
||||
suspend fun <T> suspendAndLog(value: T): T = suspendWithCurrentContinuation { x ->
|
||||
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
log += "suspend($value);"
|
||||
x.resume(value)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder1(c: suspend () -> Unit) {
|
||||
|
||||
@@ -11,9 +11,9 @@ class Controller {
|
||||
x.resume(v)
|
||||
}
|
||||
|
||||
suspend inline fun suspendInline(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend inline fun suspendInline(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
withValue(v, x)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend inline fun suspendInline(crossinline b: () -> String): String = suspendInline(b())
|
||||
|
||||
@@ -7,20 +7,20 @@ var wasCalled = false
|
||||
class Controller {
|
||||
val postponedActions = mutableListOf<() -> Unit>()
|
||||
|
||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resume(v)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resumeWithException(e)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun run(c: suspend Controller.() -> String) {
|
||||
|
||||
@@ -4,9 +4,9 @@ import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
var i = 0
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume((i++).toString())
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun runInstanceOf(): Boolean = suspendWithCurrentContinuation { x ->
|
||||
suspend fun runInstanceOf(): Boolean = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
val y: Any = x
|
||||
x.resume(x is Continuation<*>)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun runCast(): Boolean = suspendWithCurrentContinuation { x ->
|
||||
suspend fun runCast(): Boolean = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
val y: Any = x
|
||||
x.resume(Continuation::class.isInstance(y as Continuation<*>))
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
// WITH_CONTINUATION
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun <V> suspendHere(v: V): V = suspendWithCurrentContinuation { x ->
|
||||
suspend fun <V> suspendHere(v: V): V = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> String): String {
|
||||
|
||||
@@ -5,10 +5,10 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var result = ""
|
||||
var ok = false
|
||||
suspend fun suspendHere(v: String): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(v: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
result += v
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
@@ -5,10 +5,10 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var ok = false
|
||||
var v = "fail"
|
||||
suspend fun suspendHere(v: String): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(v: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
this.v = v
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ package lib
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var lastSuspension: Continuation<String>? = null
|
||||
var result = "fail"
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
lastSuspension = x
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun hasNext() = lastSuspension != null
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var lastSuspension: Continuation<String>? = null
|
||||
var result = "fail"
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
lastSuspension = x
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun hasNext() = lastSuspension != null
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var lastSuspension: Continuation<String>? = null
|
||||
var result = "fail"
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
lastSuspension = x
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun hasNext() = lastSuspension != null
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
var lastSuspension: Continuation<String>? = null
|
||||
var result = "fail"
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
lastSuspension = x
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun hasNext() = lastSuspension != null
|
||||
|
||||
@@ -7,20 +7,20 @@ var wasCalled = false
|
||||
class Controller {
|
||||
val postponedActions = ArrayList<() -> Unit>()
|
||||
|
||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resume(v)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resumeWithException(e)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun run(c: suspend Controller.() -> String) {
|
||||
|
||||
@@ -4,9 +4,9 @@ import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
var cResult = 0
|
||||
suspend fun suspendHere(v: Int): Int = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v * 2)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
var cResult = 0
|
||||
suspend fun suspendHere(v: Int): Int = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v * 2)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Int): Int {
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resumeWithException(RuntimeException("OK"))
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Int): Int {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Int = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
1
|
||||
}
|
||||
suspend fun suspendThere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
"?"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
var globalResult = ""
|
||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> String) {
|
||||
|
||||
@@ -5,9 +5,9 @@ import kotlin.coroutines.*
|
||||
class Controller {
|
||||
suspend fun suspendHere(): String = suspendThere()
|
||||
|
||||
suspend fun suspendThere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(v: Int): Int = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v * 2)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
var i = 0
|
||||
suspend fun suspendHere(): Int = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(i++)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
suspend fun suspendThere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("?")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -3,19 +3,19 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("K")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithArgument(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithArgument(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithDouble(v: Double): Double = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithDouble(v: Double): Double = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -7,20 +7,20 @@ var wasCalled = false
|
||||
class Controller {
|
||||
val postponedActions = ArrayList<() -> Unit>()
|
||||
|
||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resume(v)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resumeWithException(e)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun run(c: suspend Controller.() -> String) {
|
||||
|
||||
@@ -7,20 +7,20 @@ var wasCalled = false
|
||||
class Controller {
|
||||
val postponedActions = ArrayList<() -> Unit>()
|
||||
|
||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resume(v)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resumeWithException(e)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun run(c: suspend Controller.() -> String) {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(v)
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,20 +7,20 @@ var wasCalled = false
|
||||
class Controller {
|
||||
val postponedActions = mutableListOf<() -> Unit>()
|
||||
|
||||
suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resume(v)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun suspendWithException(e: Exception): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
postponedActions.add {
|
||||
x.resumeWithException(e)
|
||||
}
|
||||
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
fun run(c: suspend Controller.() -> String) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import kotlin.coroutines.*
|
||||
class Controller {
|
||||
suspend fun suspendHere() = suspendWithCurrentContinuation<String> { x ->
|
||||
suspend fun suspendHere() = CoroutineIntrinsics.suspendCoroutineOrReturn<String> { x ->
|
||||
x.resume("OK")
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class Controller {
|
||||
suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume(Unit)
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// WITH_COROUTINES
|
||||
// TREAT_AS_ONE_FILE
|
||||
import kotlin.coroutines.*
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// WITH_COROUTINES
|
||||
// TREAT_AS_ONE_FILE
|
||||
import kotlin.coroutines.*
|
||||
suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
||||
suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -57,12 +57,12 @@ fun <T> async(c: @Suspend() (() -> T)): CompletableFuture<T> {
|
||||
return future
|
||||
}
|
||||
|
||||
suspend fun <V> await(f: CompletableFuture<V>) = suspendWithCurrentContinuation<V> { machine ->
|
||||
suspend fun <V> await(f: CompletableFuture<V>) = CoroutineIntrinsics.suspendCoroutineOrReturn<V> { machine ->
|
||||
f.whenComplete { value, throwable ->
|
||||
if (throwable == null)
|
||||
machine.resume(value)
|
||||
else
|
||||
machine.resumeWithException(throwable)
|
||||
}
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
+2
-2
@@ -54,12 +54,12 @@ fun <T> async(c: @Suspend() (() -> T)): CompletableFuture<T> {
|
||||
return future
|
||||
}
|
||||
|
||||
suspend fun <V> await(f: CompletableFuture<V>) = suspendWithCurrentContinuation<V> { machine ->
|
||||
suspend fun <V> await(f: CompletableFuture<V>) = CoroutineIntrinsics.suspendCoroutineOrReturn<V> { machine ->
|
||||
f.whenComplete { value, throwable ->
|
||||
if (throwable == null)
|
||||
machine.resume(value)
|
||||
else
|
||||
machine.resumeWithException(throwable)
|
||||
}
|
||||
SUSPENDED
|
||||
CoroutineIntrinsics.SUSPENDED
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user