File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
core/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -135,16 +135,17 @@ internal abstract class AbstractContinuation<in T>(
135
135
136
136
// see all DispatchTask.run with the same logic
137
137
override fun run () {
138
- check( delegate is DispatchedContinuation )
138
+ delegate as DispatchedContinuation // type assertion
139
139
try {
140
140
val context = delegate.context
141
141
val job = if (resumeMode.isCancellableMode) context[Job ] else null
142
142
val state = this .state
143
+ val continuation = delegate.continuation
143
144
withCoroutineContext(context) {
144
145
when {
145
- job != null && ! job.isActive -> delegate .resumeWithException(job.getCancellationException())
146
- state is CompletedExceptionally -> delegate .resumeWithException(state.exception)
147
- else -> delegate .resume(getSuccessfulResult(state))
146
+ job != null && ! job.isActive -> continuation .resumeWithException(job.getCancellationException())
147
+ state is CompletedExceptionally -> continuation .resumeWithException(state.exception)
148
+ else -> continuation .resume(getSuccessfulResult(state))
148
149
}
149
150
}
150
151
} catch (e: Throwable ) {
You can’t perform that action at this time.
0 commit comments