[K/N] Introduce intrinsic constant constructors

This commit is contained in:
Pavel Kunyavskiy
2021-09-16 16:04:47 +03:00
committed by Space
parent 74b9eeb584
commit c7f182adbf
6 changed files with 53 additions and 6 deletions
@@ -100,6 +100,10 @@ internal annotation class PointsTo(vararg val onWhom: Int)
@Retention(AnnotationRetention.BINARY)
internal annotation class TypedIntrinsic(val kind: String)
@Target(AnnotationTarget.CONSTRUCTOR)
@Retention(AnnotationRetention.BINARY)
internal annotation class ConstantConstructorIntrinsic(val kind: String)
/**
* Indicates that `@SymbolName external` function is implemented in library-stored bitcode
* and doesn't have native dependencies.
@@ -9,6 +9,11 @@ import kotlin.reflect.KClass
@ExportForCompiler
internal class KClassImpl<T : Any>(private val typeInfo: NativePtr) : KClass<T> {
@ExportForCompiler
@ConstantConstructorIntrinsic("KCLASS_IMPL")
constructor() : this(TODO("This is intrinsic constructor and it shouldn't be used directly"))
// TODO: consider replacing '$' by another delimeter that can't be used in class name specified with backticks (``)
override val simpleName: String?
get() = getRelativeName(typeInfo, true)?.substringAfterLast('.')?.substringAfterLast('$')