Replace @Suspend to suspend in box tests.
This commit is contained in:
+1
-1
@@ -73,7 +73,7 @@ suspend fun <S> awaitAndLog(value: Promise<S>): S {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> async(c: @Suspend() (() -> T)): Promise<T> {
|
fun <T> async(c: suspend () -> T): Promise<T> {
|
||||||
return Promise { resolve ->
|
return Promise { resolve ->
|
||||||
c.startCoroutine(handleResultContinuation(resolve))
|
c.startCoroutine(handleResultContinuation(resolve))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x -> }
|
suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x -> }
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Unit)) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
var exception: Throwable? = null
|
var exception: Throwable? = null
|
||||||
|
|
||||||
c.createCoroutine(object : Continuation<Unit> {
|
c.createCoroutine(object : Continuation<Unit> {
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x ->}
|
suspend fun suspendHere(): Any = suspendWithCurrentContinuation { x ->}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Unit)) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
try {
|
try {
|
||||||
c.createCoroutine(EmptyContinuation).resumeWithException(RuntimeException("OK"))
|
c.createCoroutine(EmptyContinuation).resumeWithException(RuntimeException("OK"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ suspend fun <T> await(t: T): T = suspendWithCurrentContinuation { c ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Unit)): String {
|
fun builder(c: suspend () -> Unit): String {
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
result = "OK"
|
result = "OK"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
return controller.result
|
return controller.result
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
return controller.result
|
return controller.result
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
return controller.result
|
return controller.result
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
return controller.result
|
return controller.result
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
return controller.result
|
return controller.result
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
return controller.result
|
return controller.result
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
return controller.result
|
return controller.result
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, object : Continuation<Unit> {
|
c.startCoroutine(controller, object : Continuation<Unit> {
|
||||||
override fun resume(data: Unit) {
|
override fun resume(data: Unit) {
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, object : Continuation<Unit> {
|
c.startCoroutine(controller, object : Continuation<Unit> {
|
||||||
override fun resume(data: Unit) {}
|
override fun resume(data: Unit) {}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
return controller.result
|
return controller.result
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation)
|
c.startCoroutine(controller, EmptyContinuation)
|
||||||
if (!controller.result) throw RuntimeException("fail")
|
if (!controller.result) throw RuntimeException("fail")
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -29,13 +29,13 @@ interface Generator<in T> {
|
|||||||
suspend fun yield(value: T)
|
suspend fun yield(value: T)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> generate(block: @Suspend() (Generator<T>.() -> Unit)): Sequence<T> = GeneratedSequence(block)
|
fun <T> generate(block: suspend Generator<T>.() -> Unit): Sequence<T> = GeneratedSequence(block)
|
||||||
|
|
||||||
class GeneratedSequence<out T>(private val block: @Suspend() (Generator<T>.() -> Unit)) : Sequence<T> {
|
class GeneratedSequence<out T>(private val block: suspend Generator<T>.() -> Unit) : Sequence<T> {
|
||||||
override fun iterator(): Iterator<T> = GeneratedIterator(block)
|
override fun iterator(): Iterator<T> = GeneratedIterator(block)
|
||||||
}
|
}
|
||||||
|
|
||||||
class GeneratedIterator<T>(block: @Suspend() (Generator<T>.() -> Unit)) : AbstractIterator<T>(), Generator<T> {
|
class GeneratedIterator<T>(block: suspend Generator<T>.() -> Unit) : AbstractIterator<T>(), Generator<T> {
|
||||||
private var nextStep: Continuation<Unit> = block.createCoroutine(this, object : Continuation<Unit> {
|
private var nextStep: Continuation<Unit> = block.createCoroutine(this, object : Continuation<Unit> {
|
||||||
override fun resume(data: Unit) {
|
override fun resume(data: Unit) {
|
||||||
done()
|
done()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class Controller {
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: @Suspend() (Controller.() -> Unit)) {
|
fun run(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(this, handleExceptionContinuation {
|
c.startCoroutine(this, handleExceptionContinuation {
|
||||||
exception = it
|
exception = it
|
||||||
})
|
})
|
||||||
@@ -31,7 +31,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
controller.run(c)
|
controller.run(c)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Unit)): String {
|
fun builder(c: suspend () -> Unit): String {
|
||||||
var ok = false
|
var ok = false
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
ok = true
|
ok = true
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Unit)) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
var isCompleted = false
|
var isCompleted = false
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
isCompleted = true
|
isCompleted = true
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> String)): String {
|
fun builder(c: suspend Controller.() -> String): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, handleResultContinuation {
|
c.startCoroutine(controller, handleResultContinuation {
|
||||||
controller.log += "return($it);"
|
controller.log += "return($it);"
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ suspend fun suspendHere(): Unit = suspendWithCurrentContinuation { x ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder1(c: @Suspend() (() -> Unit)) {
|
fun builder1(c: suspend () -> Unit) {
|
||||||
(c as Continuation<Unit>).resume(Unit)
|
(c as Continuation<Unit>).resume(Unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder2(c: @Suspend() (() -> Unit)) {
|
fun builder2(c: suspend () -> Unit) {
|
||||||
val continuation = c.createCoroutine(EmptyContinuation)
|
val continuation = c.createCoroutine(EmptyContinuation)
|
||||||
val declaredField = continuation.javaClass.superclass.superclass.getDeclaredField("label")
|
val declaredField = continuation.javaClass.superclass.superclass.getDeclaredField("label")
|
||||||
declaredField.setAccessible(true)
|
declaredField.setAccessible(true)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Controller {
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: @Suspend() (Controller.() -> String)) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
c.startCoroutine(this, handleResultContinuation {
|
c.startCoroutine(this, handleResultContinuation {
|
||||||
globalResult = it
|
globalResult = it
|
||||||
})
|
})
|
||||||
@@ -32,7 +32,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(expectException: Boolean = false, c: @Suspend() (Controller.() -> String)) {
|
fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
|
|
||||||
globalResult = "#"
|
globalResult = "#"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test(c: @Suspend() (Controller.() -> Unit)): String {
|
fun test(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, EmptyContinuation, object: ResumeInterceptor {
|
c.startCoroutine(controller, EmptyContinuation, object: ResumeInterceptor {
|
||||||
private fun interceptResume(block: () -> Unit) {
|
private fun interceptResume(block: () -> Unit) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ suspend fun <V> suspendHere(v: V): V = suspendWithCurrentContinuation { x ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> String)): String {
|
fun builder(c: suspend () -> String): String {
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
result = it
|
result = it
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, handleResultContinuation {
|
c.startCoroutine(controller, handleResultContinuation {
|
||||||
controller.ok = true
|
controller.ok = true
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Unit)) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
var wasHandleResultCalled = false
|
var wasHandleResultCalled = false
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
wasHandleResultCalled = true
|
wasHandleResultCalled = true
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Unit)) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
var wasHandleResultCalled = false
|
var wasHandleResultCalled = false
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
wasHandleResultCalled = true
|
wasHandleResultCalled = true
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)): String {
|
fun builder(c: suspend Controller.() -> Unit): String {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, handleResultContinuation {
|
c.startCoroutine(controller, handleResultContinuation {
|
||||||
controller.ok = true
|
controller.ok = true
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Controller {
|
|||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
import lib.*
|
import lib.*
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ suspend fun Controller.localSuspendExtension(v: String) = v.suspendHere()
|
|||||||
|
|
||||||
inline suspend fun Controller.localInlineSuspendExtension(v: String) = v.inlineSuspendHere()
|
inline suspend fun Controller.localInlineSuspendExtension(v: String) = v.inlineSuspendHere()
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
val controller1 = Controller()
|
val controller1 = Controller()
|
||||||
val controller2 = Controller()
|
val controller2 = Controller()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
val controller1 = Controller()
|
val controller1 = Controller()
|
||||||
val controller2 = Controller()
|
val controller2 = Controller()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
val controller1 = Controller()
|
val controller1 = Controller()
|
||||||
val controller2 = Controller()
|
val controller2 = Controller()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
val controller1 = Controller()
|
val controller1 = Controller()
|
||||||
val controller2 = Controller()
|
val controller2 = Controller()
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Controller {
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: @Suspend() (Controller.() -> String)) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
c.startCoroutine(this, handleResultContinuation {
|
c.startCoroutine(this, handleResultContinuation {
|
||||||
globalResult = it
|
globalResult = it
|
||||||
})
|
})
|
||||||
@@ -34,7 +34,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(expectException: Boolean = false, c: @Suspend() (Controller.() -> String)) {
|
fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
|
|
||||||
globalResult = "#"
|
globalResult = "#"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Int)): Int {
|
fun builder(c: suspend () -> Int): Int {
|
||||||
var res = 0
|
var res = 0
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
res = it
|
res = it
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Int)): Controller {
|
fun builder(c: suspend Controller.() -> Int): Controller {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, handleResultContinuation {
|
c.startCoroutine(controller, handleResultContinuation {
|
||||||
controller.cResult = it
|
controller.cResult = it
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Int)): Controller {
|
fun builder(c: suspend Controller.() -> Int): Controller {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
c.startCoroutine(controller, handleResultContinuation {
|
c.startCoroutine(controller, handleResultContinuation {
|
||||||
controller.cResult = it
|
controller.cResult = it
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> Int)): Int {
|
fun builder(c: suspend () -> Int): Int {
|
||||||
var res = 0
|
var res = 0
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
res = it
|
res = it
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() () -> Unit) {
|
fun builder(c: suspend () -> Unit) {
|
||||||
c.startCoroutine(EmptyContinuation)
|
c.startCoroutine(EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ suspend fun suspendHere(): String = suspendWithCurrentContinuation { x ->
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() () -> Int): Int {
|
fun builder(c: suspend () -> Int): Int {
|
||||||
var res = 0
|
var res = 0
|
||||||
|
|
||||||
c.createCoroutine(object : Continuation<Int> {
|
c.createCoroutine(object : Continuation<Int> {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ suspend fun suspendWithValue(v: String): String = suspendWithCurrentContinuation
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (() -> String)) {
|
fun builder(c: suspend () -> String) {
|
||||||
c.startCoroutine(handleResultContinuation {
|
c.startCoroutine(handleResultContinuation {
|
||||||
globalResult = it
|
globalResult = it
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ suspend fun Controller.suspendExtension(v: String): String = v.suspendHere()
|
|||||||
|
|
||||||
inline suspend fun Controller.inlineSuspendExtension(v: String): String = v.inlineSuspendHere()
|
inline suspend fun Controller.inlineSuspendExtension(v: String): String = v.inlineSuspendHere()
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -21,7 +21,7 @@ class Controller {
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: @Suspend() (Controller.() -> String)) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
c.startCoroutine(this, handleResultContinuation {
|
c.startCoroutine(this, handleResultContinuation {
|
||||||
globalResult = it
|
globalResult = it
|
||||||
})
|
})
|
||||||
@@ -34,7 +34,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(expectException: Boolean = false, c: @Suspend() (Controller.() -> String)) {
|
fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
|
|
||||||
globalResult = "#"
|
globalResult = "#"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Controller {
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: @Suspend() (Controller.() -> String)) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
c.startCoroutine(this, handleResultContinuation {
|
c.startCoroutine(this, handleResultContinuation {
|
||||||
globalResult = it
|
globalResult = it
|
||||||
})
|
})
|
||||||
@@ -32,7 +32,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(expectException: Boolean = false, c: @Suspend() (Controller.() -> String)) {
|
fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
|
|
||||||
globalResult = "#"
|
globalResult = "#"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Controller {
|
|||||||
SUSPENDED
|
SUSPENDED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run(c: @Suspend() (Controller.() -> String)) {
|
fun run(c: suspend Controller.() -> String) {
|
||||||
c.startCoroutine(this, handleResultContinuation {
|
c.startCoroutine(this, handleResultContinuation {
|
||||||
globalResult = it
|
globalResult = it
|
||||||
})
|
})
|
||||||
@@ -34,7 +34,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(expectException: Boolean = false, c: @Suspend() (Controller.() -> String)) {
|
fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) {
|
||||||
val controller = Controller()
|
val controller = Controller()
|
||||||
|
|
||||||
globalResult = "#"
|
globalResult = "#"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class Controller {
|
|||||||
// INTERCEPT_RESUME_PLACEHOLDER
|
// INTERCEPT_RESUME_PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
fun builder(c: @Suspend() (Controller.() -> Unit)) {
|
fun builder(c: suspend Controller.() -> Unit) {
|
||||||
c.startCoroutine(Controller(), EmptyContinuation)
|
c.startCoroutine(Controller(), EmptyContinuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user