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>(
135135
136136 // see all DispatchTask.run with the same logic
137137 override fun run () {
138- check( delegate is DispatchedContinuation )
138+ delegate as DispatchedContinuation // type assertion
139139 try {
140140 val context = delegate.context
141141 val job = if (resumeMode.isCancellableMode) context[Job ] else null
142142 val state = this .state
143+ val continuation = delegate.continuation
143144 withCoroutineContext(context) {
144145 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))
148149 }
149150 }
150151 } catch (e: Throwable ) {
You can’t perform that action at this time.
0 commit comments