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

org.jetbrains.kotlin.fir.backend.Fir2IrSyntheticIrBuiltinsSymbolsContainer.kt Maven / Gradle / Ivy

There is a newer version: 2.1.0-RC
Show 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.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()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy