Make intrinsics be external functions

This commit is contained in:
Pavel Punegov
2018-02-20 20:19:07 +03:00
committed by Pavel Punegov
parent 6e3d751a17
commit 0761108399
2 changed files with 10 additions and 5 deletions
@@ -74,9 +74,14 @@ internal fun <T : CallableMemberDescriptor> T.resolveFakeOverride(): T {
private val intrinsicAnnotation = FqName("konan.internal.Intrinsic")
// TODO: check it is external?
internal val CallableDescriptor.isIntrinsic: Boolean
get() = this.annotations.findAnnotation(intrinsicAnnotation) != null
internal val FunctionDescriptor.isIntrinsic: Boolean
get() = when {
this.annotations.hasAnnotation(intrinsicAnnotation) -> {
check(isExternal, { "Intrinsic function $name should be external" })
true
}
else -> false
}
private val intrinsicTypes = setOf(
"kotlin.Boolean", "kotlin.Char",
@@ -21,11 +21,11 @@ import kotlin.coroutines.experimental.intrinsics.*
@Intrinsic
@PublishedApi
internal fun <T> getContinuation(): Continuation<T> = throw AssertionError("Call to getContinuation should've been lowered")
internal external fun <T> getContinuation(): Continuation<T> = throw AssertionError("Call to getContinuation should've been lowered")
@Intrinsic
@PublishedApi
internal suspend fun <T> returnIfSuspended(@Suppress("UNUSED_PARAMETER") argument: Any?): T
internal external suspend fun <T> returnIfSuspended(@Suppress("UNUSED_PARAMETER") argument: Any?): T
= throw AssertionError("Call to returnIfSuspended should've been lowered")
// Single-threaded continuation.