Native: represent ExperimentalForeignApi in cinterop's Stub IR
cinterop tool should add ExperimentalForeignApi to all generated declarations by default. This commit supports this annotation in cinterop intermediate representation -- Stub IR. ^KT-58362
This commit is contained in:
committed by
Space Team
parent
7ca0cb1077
commit
d118844b17
+2
@@ -224,6 +224,8 @@ object KotlinTypes {
|
||||
|
||||
val cValue by InteropClassifier
|
||||
|
||||
val experimentalForeignApi by InteropClassifier
|
||||
|
||||
private open class ClassifierAtPackage(val pkg: String) {
|
||||
operator fun getValue(thisRef: KotlinTypes, property: KProperty<*>): Classifier =
|
||||
Classifier.topLevel(pkg, property.name.replaceFirstChar(Char::uppercaseChar))
|
||||
|
||||
+2
@@ -264,6 +264,8 @@ sealed class AnnotationStub(val classifier: Classifier) {
|
||||
class CEnumVarTypeSize(val size: Int) :
|
||||
AnnotationStub(Classifier.topLevel(cinteropInternalPackage, "CEnumVarTypeSize"))
|
||||
|
||||
object ExperimentalForeignApi : AnnotationStub(KotlinTypes.experimentalForeignApi)
|
||||
|
||||
private companion object {
|
||||
val cCallClassifier = Classifier.topLevel(cinteropInternalPackage, "CCall")
|
||||
|
||||
|
||||
+1
@@ -444,6 +444,7 @@ private class MappingExtensions(
|
||||
)
|
||||
is AnnotationStub.CStruct.CPlusPlusClass -> emptyMap()
|
||||
is AnnotationStub.CStruct.ManagedType -> emptyMap()
|
||||
is AnnotationStub.ExperimentalForeignApi -> emptyMap()
|
||||
}
|
||||
return KmAnnotation(classifier.fqNameSerialized, args)
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
package org.jetbrains.kotlin.native.interop.gen
|
||||
|
||||
import kotlinx.cinterop.ExperimentalForeignApi
|
||||
import org.jetbrains.kotlin.native.interop.gen.jvm.KotlinPlatform
|
||||
import org.jetbrains.kotlin.native.interop.indexer.*
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
@@ -506,6 +505,8 @@ class StubIrTextEmitter(
|
||||
"@Deprecated(${annotationStub.message.quoteAsKotlinLiteral()}, " +
|
||||
"ReplaceWith(${annotationStub.replaceWith.quoteAsKotlinLiteral()}), " +
|
||||
"DeprecationLevel.${annotationStub.level.name})"
|
||||
is AnnotationStub.ExperimentalForeignApi ->
|
||||
"@${KotlinTypes.experimentalForeignApi.topLevelName}"
|
||||
is AnnotationStub.CEnumEntryAlias,
|
||||
is AnnotationStub.CEnumVarTypeSize,
|
||||
is AnnotationStub.CStruct.MemberAt,
|
||||
|
||||
Reference in New Issue
Block a user