[minor] IR: minor builtins infrastructure fixes
This commit is contained in:
committed by
TeamCityServer
parent
19f52d9aae
commit
56805dded8
+3
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.extensions
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.BuiltinSymbolsBase
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
@@ -34,6 +35,8 @@ interface IrPluginContext : IrGeneratorContext {
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
val typeTranslator: TypeTranslator
|
||||
|
||||
val symbols: BuiltinSymbolsBase
|
||||
|
||||
val platform: TargetPlatform?
|
||||
|
||||
/**
|
||||
|
||||
+3
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.extensions
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.BuiltinSymbolsBase
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
@@ -34,7 +35,8 @@ open class IrPluginContextImpl constructor(
|
||||
override val typeTranslator: TypeTranslator,
|
||||
override val irBuiltIns: IrBuiltIns,
|
||||
val linker: IrDeserializer,
|
||||
private val diagnosticReporter: IrMessageLogger
|
||||
private val diagnosticReporter: IrMessageLogger,
|
||||
override val symbols: BuiltinSymbolsBase = BuiltinSymbolsBase(irBuiltIns, st)
|
||||
) : IrPluginContext {
|
||||
|
||||
override val platform: TargetPlatform? = module.platform
|
||||
|
||||
@@ -44,11 +44,7 @@ abstract class Ir<out T : CommonBackendContext>(val context: T, val irModule: Ir
|
||||
open fun shouldGenerateHandlerParameterForDefaultBodyFun() = false
|
||||
}
|
||||
|
||||
// Some symbols below are used in kotlin-native, so they can't be private
|
||||
@Suppress("MemberVisibilityCanBePrivate", "PropertyName")
|
||||
abstract class Symbols<out T : CommonBackendContext>(
|
||||
val context: T, val irBuiltIns: IrBuiltIns, private val symbolTable: ReferenceSymbolTable
|
||||
) {
|
||||
open class BuiltinSymbolsBase(val irBuiltIns: IrBuiltIns, private val symbolTable: ReferenceSymbolTable) {
|
||||
|
||||
private fun getClass(name: Name, vararg packageNameSegments: String = arrayOf("kotlin")): IrClassSymbol =
|
||||
irBuiltIns.findClass(name, *packageNameSegments)
|
||||
@@ -150,11 +146,11 @@ abstract class Symbols<out T : CommonBackendContext>(
|
||||
val doubleArrayType get() = doubleArray.owner.defaultType
|
||||
val booleanArrayType get() = booleanArray.owner.defaultType
|
||||
|
||||
val primitiveArrays get() = irBuiltIns.primitiveTypesToPrimitiveArrays
|
||||
val primitiveTypesToPrimitiveArrays get() = irBuiltIns.primitiveTypesToPrimitiveArrays
|
||||
val primitiveArraysToPrimitiveTypes get() = irBuiltIns.primitiveArraysToPrimitiveTypes
|
||||
val unsignedArrays get() = irBuiltIns.unsignedTypesToUnsignedArrays
|
||||
val unsignedTypesToUnsignedArrays get() = irBuiltIns.unsignedTypesToUnsignedArrays
|
||||
|
||||
val arrays = primitiveArrays.values + unsignedArrays.values + array
|
||||
val arrays get() = primitiveTypesToPrimitiveArrays.values + unsignedTypesToUnsignedArrays.values + array
|
||||
|
||||
val collection get() = irBuiltIns.collectionClass
|
||||
val set get() = irBuiltIns.setClass
|
||||
@@ -193,7 +189,14 @@ abstract class Symbols<out T : CommonBackendContext>(
|
||||
|
||||
val extensionToString: IrSimpleFunctionSymbol get() = irBuiltIns.extensionToString
|
||||
val stringPlus: IrSimpleFunctionSymbol get() = irBuiltIns.stringPlus
|
||||
|
||||
}
|
||||
|
||||
// Some symbols below are used in kotlin-native, so they can't be private
|
||||
@Suppress("MemberVisibilityCanBePrivate", "PropertyName")
|
||||
abstract class Symbols<out T : CommonBackendContext>(
|
||||
val context: T, irBuiltIns: IrBuiltIns, symbolTable: ReferenceSymbolTable
|
||||
) : BuiltinSymbolsBase(irBuiltIns, symbolTable) {
|
||||
|
||||
abstract val throwNullPointerException: IrSimpleFunctionSymbol
|
||||
abstract val throwTypeCastException: IrSimpleFunctionSymbol
|
||||
|
||||
|
||||
Reference in New Issue
Block a user