[IR] Pass IrBuiltIns to BuiltinSymbolsBase

This commit is contained in:
Roman Artemev
2020-04-20 14:02:18 +03:00
committed by romanart
parent da661e4db7
commit 318568636e
3 changed files with 3 additions and 5 deletions
@@ -25,7 +25,7 @@ class IrPluginContext(
val symbolTable: SymbolTable,
val typeTranslator: TypeTranslator,
override val irBuiltIns: IrBuiltIns,
val symbols: BuiltinSymbolsBase = BuiltinSymbolsBase(irBuiltIns.builtIns, symbolTable)
val symbols: BuiltinSymbolsBase = BuiltinSymbolsBase(irBuiltIns, irBuiltIns.builtIns, symbolTable)
) : IrGeneratorContext()
interface IrGenerationExtension : IrExtensionGenerator {
@@ -48,7 +48,7 @@ abstract class Ir<out T : CommonBackendContext>(val context: T, val irModule: Ir
/**
* Symbols for builtins that are available without any context and are not specific to any backend
*/
open class BuiltinSymbolsBase(protected val builtIns: KotlinBuiltIns, private val symbolTable: SymbolTable) {
open class BuiltinSymbolsBase(protected val irBuiltIns: IrBuiltIns, private val builtIns: KotlinBuiltIns, private val symbolTable: SymbolTable) {
protected fun builtInsPackage(vararg packageNameSegments: String) =
builtIns.builtInsModule.getPackage(FqName.fromSegments(listOf(*packageNameSegments))).memberScope
@@ -232,7 +232,7 @@ open class BuiltinSymbolsBase(protected val builtIns: KotlinBuiltIns, private va
// 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, symbolTable: SymbolTable) :
BuiltinSymbolsBase(context.builtIns, symbolTable) {
BuiltinSymbolsBase(context.irBuiltIns, context.builtIns, symbolTable) {
abstract val ThrowNullPointerException: IrFunctionSymbol
abstract val ThrowNoWhenBranchMatchedException: IrFunctionSymbol
abstract val ThrowTypeCastException: IrFunctionSymbol
@@ -50,8 +50,6 @@ class JvmSymbols(
private val kotlinReflectPackage: IrPackageFragment = createPackage(FqName("kotlin.reflect"))
private val javaLangPackage: IrPackageFragment = createPackage(FqName("java.lang"))
private val irBuiltIns = context.irBuiltIns
private val generateOptimizedCallableReferenceSuperClasses = context.state.generateOptimizedCallableReferenceSuperClasses
private val nullPointerExceptionClass: IrClassSymbol =