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

org.jetbrains.kotlin.sir.providers.utils.KotlinRuntimeModule.kt Maven / Gradle / Ivy

Go to download

SIR Providers - family of classes, that transforms KaSymbol into corresponding SIR nodes

The newest version!
/*
 * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
 * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
 */

package org.jetbrains.kotlin.sir.providers.utils

import org.jetbrains.kotlin.sir.*
import org.jetbrains.kotlin.sir.builder.buildClass
import org.jetbrains.kotlin.sir.builder.buildInit
import org.jetbrains.kotlin.sir.providers.source.KotlinRuntimeElement
import org.jetbrains.kotlin.sir.util.SirSwiftModule

/**
 * Models `KotlinRuntime` module which contains declarations that are
 * required for integration with Kotlin/Native runtime.
 */
public object KotlinRuntimeModule : SirModule() {

    override val imports: MutableList = mutableListOf()

    override val name: String = "KotlinRuntime"

    override val declarations: MutableList by lazy {
        mutableListOf(
            kotlinBase
        )
    }

    public val kotlinBase: SirClass by lazy {
        buildClass {
            name = "KotlinBase"
            origin = KotlinRuntimeElement()
            declarations += buildInit {
                origin = KotlinRuntimeElement()
                kind = SirCallableKind.CLASS_METHOD
                isFailable = false
                initKind = SirInitializerKind.ORDINARY
                isOverride = false
            }
            declarations += buildInit {
                origin = KotlinRuntimeElement()
                kind = SirCallableKind.CLASS_METHOD
                isFailable = false
                initKind = SirInitializerKind.ORDINARY
                isOverride = false
                parameters.add(SirParameter(argumentName = "__externalRCRef", type = SirNominalType(SirSwiftModule.uint)))
            }
        }.also { klass ->
            klass.parent = KotlinRuntimeModule
            klass.declarations.forEach { it.parent = klass }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy