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
@@ -17,7 +17,7 @@ import kotlin.coroutines.intrinsics.*
public fun <R, T> (suspend R.() -> T).createCoroutine(
receiver: R,
completion: Continuation<T>
): Continuation<Unit> = (this as kotlin.jvm.internal.SuspendFunction1<R, T>).create(receiver, completion)
): Continuation<Unit> = (this as kotlin.jvm.internal.CoroutineImpl).create(receiver, completion)
/**
* Starts coroutine with receiver type [R] and result type [T].
@@ -43,7 +43,7 @@ public fun <R, T> (suspend R.() -> T).startCoroutine(
@Suppress("UNCHECKED_CAST")
public fun <T> (suspend () -> T).createCoroutine(
completion: Continuation<T>
): Continuation<Unit> = (this as kotlin.jvm.internal.SuspendFunction0<T>).create(completion)
): Continuation<Unit> = (this as kotlin.jvm.internal.CoroutineImpl).create(completion)
/**
* Starts coroutine without receiver and with result type [T].
@@ -485,6 +485,8 @@ public abstract class kotlin/jvm/internal/CoroutineImpl : kotlin/jvm/internal/La
protected field completion Lkotlin/coroutines/Continuation;
protected field label I
public fun <init> (ILkotlin/coroutines/Continuation;)V
public fun create (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
public fun create (Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
protected abstract fun doResume (Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;
public fun getContext ()Lkotlin/coroutines/CoroutineContext;
public final fun getFacade ()Lkotlin/coroutines/Continuation;
@@ -903,14 +905,6 @@ public final class kotlin/jvm/internal/StringCompanionObject {
public static final field INSTANCE Lkotlin/jvm/internal/StringCompanionObject;
}
public abstract interface class kotlin/jvm/internal/SuspendFunction0 {
public abstract fun create (Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
}
public abstract interface class kotlin/jvm/internal/SuspendFunction1 {
public abstract fun create (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
}
public class kotlin/jvm/internal/TypeIntrinsics {
public fun <init> ()V
public static fun asMutableCollection (Ljava/lang/Object;)Ljava/util/Collection;