Get rid of SuspendFunctionX interfaces

Use a pair of effectively abstract methods in CoroutineImpl instead
This commit is contained in:
Denis Zharkov
2017-01-14 13:54:04 +03:00
parent d346cbbe61
commit 85a3fefcc6
5 changed files with 16 additions and 44 deletions
@@ -16,7 +16,10 @@
package kotlin.jvm.internal
import kotlin.coroutines.*
import java.lang.IllegalStateException
import kotlin.coroutines.Continuation
import kotlin.coroutines.ContinuationInterceptor
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.intrinsics.SUSPENDED_MARKER
abstract class CoroutineImpl(
@@ -63,4 +66,12 @@ abstract class CoroutineImpl(
}
protected abstract fun doResume(data: Any?, exception: Throwable?): Any?
open fun create(completion: Continuation<*>): Continuation<Unit> {
throw IllegalStateException("create(Continuation) has not been overridden")
}
open fun create(value: Any?, completion: Continuation<*>): Continuation<Unit> {
throw IllegalStateException("create(Any?;Continuation) has not been overridden")
}
}
@@ -1,27 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package kotlin.jvm.internal
import kotlin.coroutines.Continuation
interface SuspendFunction0<out R> {
fun create(resultingContinuation: Continuation<R>): Continuation<Unit>
}
interface SuspendFunction1<in T, out R> {
fun create(value: T, resultingContinuation: Continuation<R>): Continuation<Unit>
}