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

commonMain.co.touchlab.skie.oir.element.OirFunction.kt Maven / Gradle / Ivy

Go to download

Kotlin compiler plugin that improves Swift interface of a Kotlin Multiplatform framework.

The newest version!
package co.touchlab.skie.oir.element

import co.touchlab.skie.oir.type.OirType

abstract class OirFunction(
    final override val parent: OirCallableDeclarationParent,
) : OirCallableDeclaration {

    abstract val selector: String

    abstract val errorHandlingStrategy: ErrorHandlingStrategy

    abstract val returnType: OirType?

    val baseSelector: String
        get() = selector.substringBefore(':')

    val valueParameters: MutableList = mutableListOf()

    init {
        @Suppress("LeakingThis")
        parent.callableDeclarations.add(this)
    }

    override fun toString(): String = "${this::class.simpleName}: $selector"

    enum class ErrorHandlingStrategy {
        Crashes,
        ReturnsBoolean,
        ReturnsZero,
        SetsErrorOut;

        val isThrowing: Boolean
            get() = this != Crashes
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy