Fix WITH_COROUTINES tests compilation on Native after 5617d83c
This commit is contained in:
committed by
Space
parent
84d78035e4
commit
59b5475350
+16
-1
@@ -36,6 +36,21 @@ open class EmptyContinuation(override val context: CoroutineContext = EmptyCorou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class ContinuationAdapter<in T> : Continuation<T> {
|
||||||
|
override val context: CoroutineContext = EmptyCoroutineContext
|
||||||
|
|
||||||
|
override fun resumeWith(result: Result<T>) {
|
||||||
|
if (result.isSuccess) {
|
||||||
|
resume(result.getOrThrow())
|
||||||
|
} else {
|
||||||
|
resumeWithException(result.exceptionOrNull()!!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract fun resumeWithException(exception: Throwable)
|
||||||
|
abstract fun resume(value: T)
|
||||||
|
}
|
||||||
|
|
||||||
class StateMachineCheckerClass {
|
class StateMachineCheckerClass {
|
||||||
private var counter = 0
|
private var counter = 0
|
||||||
var finished = false
|
var finished = false
|
||||||
@@ -66,7 +81,7 @@ class StateMachineCheckerClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val StateMachineChecker = StateMachineCheckerClass()
|
val StateMachineChecker = StateMachineCheckerClass()
|
||||||
object CheckStateMachineContinuation: Continuation<Unit>() {
|
object CheckStateMachineContinuation: Continuation<Unit> {
|
||||||
override val context: CoroutineContext
|
override val context: CoroutineContext
|
||||||
get() = EmptyCoroutineContext
|
get() = EmptyCoroutineContext
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user