org.jetbrains.kotlin.fir.backend.Fir2IrSyntheticIrBuiltinsSymbolsContainer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-embeddable Show documentation
Show all versions of kotlin-compiler-embeddable Show documentation
the Kotlin compiler embeddable
/*
* 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.fir.backend
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.builtins.PrimitiveType.*
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
class Fir2IrSyntheticIrBuiltinsSymbolsContainer {
private val primitiveIntegralTypes: List = listOf(BYTE, SHORT, INT, LONG)
val primitiveFloatingPointTypes: List = listOf(FLOAT, DOUBLE)
private val primitiveNumericIrTypes: List = primitiveIntegralTypes + primitiveFloatingPointTypes
val primitiveIrTypesWithComparisons: List = primitiveNumericIrTypes + CHAR
val eqeqeqSymbol: IrSimpleFunctionSymbol = symbol()
val eqeqSymbol: IrSimpleFunctionSymbol = symbol()
val noWhenBranchMatchedExceptionSymbol: IrSimpleFunctionSymbol = symbol()
val checkNotNullSymbol: IrSimpleFunctionSymbol = symbol()
// ------------------------- primitive types symbol maps -------------------------
val lessFunByOperandType: Map = primitiveIrTypesWithComparisons.symbols()
val lessOrEqualFunByOperandType: Map = primitiveIrTypesWithComparisons.symbols()
val greaterOrEqualFunByOperandType: Map = primitiveIrTypesWithComparisons.symbols()
val greaterFunByOperandType: Map = primitiveIrTypesWithComparisons.symbols()
val ieee754equalsFunByOperandType: Map = primitiveFloatingPointTypes.symbols()
// ------------------------- utilities -------------------------
private fun List.symbols(): Map = associateWith { symbol() }
private fun symbol(): IrSimpleFunctionSymbol = IrSimpleFunctionSymbolImpl()
}