Introduce createCoroutineUnchecked intrinsic

Also use it for buildSequence implenentation

 #KT-16155 Fixed
This commit is contained in:
Denis Zharkov
2017-02-03 14:03:30 +03:00
parent 9a71a20ad6
commit 4f6a77cf38
13 changed files with 107 additions and 97 deletions
@@ -14,14 +14,3 @@ internal header class SafeContinuation<in T> : Continuation<T> {
override fun resume(value: T): Unit
override fun resumeWithException(exception: Throwable): Unit
}
@SinceKotlin("1.1")
internal header fun <T> (suspend () -> T).createCoroutineInternal(
completion: Continuation<T>
): Continuation<Unit>
@SinceKotlin("1.1")
internal header fun <R, T> (suspend R.() -> T).createCoroutineInternal(
receiver: R,
completion: Continuation<T>
): Continuation<Unit>
@@ -0,0 +1,30 @@
/*
* Copyright 2010-2017 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.coroutines.experimental.intrinsics
import kotlin.coroutines.experimental.Continuation
@SinceKotlin("1.1")
public header fun <T> (suspend () -> T).createCoroutineUnchecked(
completion: Continuation<T>
): Continuation<Unit>
@SinceKotlin("1.1")
public header fun <R, T> (suspend R.() -> T).createCoroutineUnchecked(
receiver: R,
completion: Continuation<T>
): Continuation<Unit>