Use package property COROUTINE_SUSPENDED instead of enum entry

For sake of encapsulation: actual property content might be
different from the entry
This commit is contained in:
Denis Zharkov
2018-08-20 12:29:21 +03:00
parent 944b0d058a
commit db34555800
4 changed files with 7 additions and 5 deletions
@@ -6,6 +6,7 @@
package kotlin.coroutines
import kotlin.coroutines.intrinsics.CoroutineSingletons.*
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
@PublishedApi
@SinceKotlin("1.3")
@@ -5,7 +5,7 @@
package kotlin.coroutines
import kotlin.coroutines.intrinsics.CoroutineSingletons
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
@SinceKotlin("1.3")
@JsName("CoroutineImpl")
@@ -45,7 +45,7 @@ internal abstract class CoroutineImpl(private val resultContinuation: Continuati
try {
val outcome = doResume()
if (outcome === CoroutineSingletons.COROUTINE_SUSPENDED) return
if (outcome === COROUTINE_SUSPENDED) return
currentResult = outcome
currentException = null
} catch (exception: dynamic) { // Catch all exceptions
@@ -89,4 +89,4 @@ internal object CompletedContinuation : Continuation<Any?> {
}
override fun toString(): String = "This continuation is already complete"
}
}
@@ -7,6 +7,7 @@ package kotlin.coroutines
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater
import kotlin.*
import kotlin.coroutines.intrinsics.CoroutineSingletons.*
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
@PublishedApi
@SinceKotlin("1.3")
@@ -7,7 +7,7 @@ package kotlin.coroutines.jvm.internal
import java.io.Serializable
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.CoroutineSingletons
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
import kotlin.jvm.internal.FunctionBase
import kotlin.jvm.internal.Reflection
@@ -30,7 +30,7 @@ internal abstract class BaseContinuationImpl(
val outcome: SuccessOrFailure<Any?> =
try {
val outcome = invokeSuspend(param)
if (outcome === CoroutineSingletons.COROUTINE_SUSPENDED) return
if (outcome === COROUTINE_SUSPENDED) return
SuccessOrFailure.success(outcome)
} catch (exception: Throwable) {
SuccessOrFailure.failure(exception)