Reformat coroutine sources

This commit is contained in:
Ilya Gorbunov
2018-11-17 00:45:03 +03:00
parent ec3692026d
commit 7d61a2de73
5 changed files with 21 additions and 17 deletions
@@ -84,13 +84,15 @@ public inline class Result<out T> @PublishedApi internal constructor(
/** /**
* Returns an instance that encapsulates the given [value] as successful value. * Returns an instance that encapsulates the given [value] as successful value.
*/ */
@InlineOnly public inline fun <T> success(value: T): Result<T> = @InlineOnly
public inline fun <T> success(value: T): Result<T> =
Result(value) Result(value)
/** /**
* Returns an instance that encapsulates the given [exception] as failure. * Returns an instance that encapsulates the given [exception] as failure.
*/ */
@InlineOnly public inline fun <T> failure(exception: Throwable): Result<T> = @InlineOnly
public inline fun <T> failure(exception: Throwable): Result<T> =
Result(createFailure(exception)) Result(createFailure(exception))
} }
@@ -7,7 +7,6 @@ package kotlin.coroutines
import kotlin.coroutines.intrinsics.* import kotlin.coroutines.intrinsics.*
import kotlin.internal.InlineOnly import kotlin.internal.InlineOnly
import kotlin.jvm.JvmName
/** /**
* Interface representing a continuation after a suspension point that returns value of type `T`. * Interface representing a continuation after a suspension point that returns value of type `T`.
@@ -40,7 +39,8 @@ public annotation class RestrictsSuspension
* Resumes the execution of the corresponding coroutine passing [value] as the return value of the last suspension point. * Resumes the execution of the corresponding coroutine passing [value] as the return value of the last suspension point.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@InlineOnly public inline fun <T> Continuation<T>.resume(value: T): Unit = @InlineOnly
public inline fun <T> Continuation<T>.resume(value: T): Unit =
resumeWith(Result.success(value)) resumeWith(Result.success(value))
/** /**
@@ -48,7 +48,8 @@ public annotation class RestrictsSuspension
* last suspension point. * last suspension point.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@InlineOnly public inline fun <T> Continuation<T>.resumeWithException(exception: Throwable): Unit = @InlineOnly
public inline fun <T> Continuation<T>.resumeWithException(exception: Throwable): Unit =
resumeWith(Result.failure(exception)) resumeWith(Result.failure(exception))
@@ -56,7 +57,8 @@ public annotation class RestrictsSuspension
* Creates [Continuation] instance with a given [context] and a given implementation of [resumeWith] method. * Creates [Continuation] instance with a given [context] and a given implementation of [resumeWith] method.
*/ */
@SinceKotlin("1.3") @SinceKotlin("1.3")
@InlineOnly public inline fun <T> Continuation( @InlineOnly
public inline fun <T> Continuation(
context: CoroutineContext, context: CoroutineContext,
crossinline resumeWith: (Result<T>) -> Unit crossinline resumeWith: (Result<T>) -> Unit
): Continuation<T> = ): Continuation<T> =