All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.seskar.compiler.native.backend.JsNative.kt Maven / Gradle / Ivy

There is a newer version: 3.32.0
Show newest version
package seskar.compiler.native.backend

import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.util.getAnnotation
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name

private val JS_NATIVE = FqName("seskar.js.JsNative")

private val ANNOTATION_MAP = mapOf(
    "get" to ClassId(FqName("kotlin.js"), Name.identifier("nativeGetter")),
    "set" to ClassId(FqName("kotlin.js"), Name.identifier("nativeSetter")),
    "invoke" to ClassId(FqName("kotlin.js"), Name.identifier("nativeInvoke")),
)

internal fun IrFunction.nativeAnnotation(): ClassId? {
    getAnnotation(JS_NATIVE) ?: return null

    return ANNOTATION_MAP.getValue(name.identifier)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy