Extract utils from ReferenceSymbolTable
This commit is contained in:
+1
-11
@@ -7,9 +7,7 @@ package org.jetbrains.kotlin.ir.declarations.lazy
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator
|
||||
import org.jetbrains.kotlin.ir.util.ReferenceSymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
|
||||
|
||||
class IrLazySymbolTable(private val originalTable: SymbolTable) : ReferenceSymbolTable by originalTable {
|
||||
@@ -59,12 +57,4 @@ class IrLazySymbolTable(private val originalTable: SymbolTable) : ReferenceSymbo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun referenceFunction(callable: CallableDescriptor): IrFunctionSymbol {
|
||||
return super.referenceFunction(callable)
|
||||
}
|
||||
|
||||
override fun referenceClassifier(classifier: ClassifierDescriptor): IrClassifierSymbol {
|
||||
return super.referenceClassifier(classifier)
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,7 @@ import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrTypeParameterImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.toIrType
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -328,3 +325,23 @@ fun IrFunction.createDispatchReceiverParameter() {
|
||||
null
|
||||
).also { it.parent = this }
|
||||
}
|
||||
|
||||
fun ReferenceSymbolTable.referenceClassifier(classifier: ClassifierDescriptor): IrClassifierSymbol =
|
||||
when (classifier) {
|
||||
is TypeParameterDescriptor ->
|
||||
referenceTypeParameter(classifier)
|
||||
is ClassDescriptor ->
|
||||
referenceClass(classifier)
|
||||
else ->
|
||||
throw IllegalArgumentException("Unexpected classifier descriptor: $classifier")
|
||||
}
|
||||
|
||||
fun ReferenceSymbolTable.referenceFunction(callable: CallableDescriptor): IrFunctionSymbol =
|
||||
when (callable) {
|
||||
is ClassConstructorDescriptor ->
|
||||
referenceConstructor(callable)
|
||||
is FunctionDescriptor ->
|
||||
referenceSimpleFunction(callable)
|
||||
else ->
|
||||
throw IllegalArgumentException("Unexpected callable descriptor: $callable")
|
||||
}
|
||||
|
||||
@@ -42,26 +42,6 @@ interface ReferenceSymbolTable {
|
||||
fun referenceTypeParameter(classifier: TypeParameterDescriptor): IrTypeParameterSymbol
|
||||
fun referenceVariable(descriptor: VariableDescriptor): IrVariableSymbol
|
||||
|
||||
fun referenceFunction(callable: CallableDescriptor): IrFunctionSymbol =
|
||||
when (callable) {
|
||||
is ClassConstructorDescriptor ->
|
||||
referenceConstructor(callable)
|
||||
is FunctionDescriptor ->
|
||||
referenceSimpleFunction(callable)
|
||||
else ->
|
||||
throw IllegalArgumentException("Unexpected callable descriptor: $callable")
|
||||
}
|
||||
|
||||
fun referenceClassifier(classifier: ClassifierDescriptor): IrClassifierSymbol =
|
||||
when (classifier) {
|
||||
is TypeParameterDescriptor ->
|
||||
referenceTypeParameter(classifier)
|
||||
is ClassDescriptor ->
|
||||
referenceClass(classifier)
|
||||
else ->
|
||||
throw IllegalArgumentException("Unexpected classifier descriptor: $classifier")
|
||||
}
|
||||
|
||||
|
||||
val declarationSystemTable: SymbolTable
|
||||
val referenceSymbolTable: ReferenceSymbolTable
|
||||
|
||||
Reference in New Issue
Block a user