[IR] Introduce new functions for referencing declarations from IrPluginContext
Those functions take `ClassId` and `CallableId`, which is more correct than using just `FqName`. Also implement those functions for `Fir2IrPluginContext`
This commit is contained in:
committed by
teamcity
parent
a30216c655
commit
76622097e4
+9
@@ -16,6 +16,8 @@ import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.ir.util.ReferenceSymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.TypeTranslator
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
@@ -53,6 +55,13 @@ interface IrPluginContext : IrGeneratorContext {
|
||||
fun referenceFunctions(fqName: FqName): Collection<IrSimpleFunctionSymbol>
|
||||
fun referenceProperties(fqName: FqName): Collection<IrPropertySymbol>
|
||||
|
||||
// This one is experimental too
|
||||
fun referenceClass(classId: ClassId): IrClassSymbol?
|
||||
fun referenceTypeAlias(classId: ClassId): IrTypeAliasSymbol?
|
||||
fun referenceConstructors(classId: ClassId): Collection<IrConstructorSymbol>
|
||||
fun referenceFunctions(callableId: CallableId): Collection<IrSimpleFunctionSymbol>
|
||||
fun referenceProperties(callableId: CallableId): Collection<IrPropertySymbol>
|
||||
|
||||
// temporary solution to load synthetic top-level declaration
|
||||
fun referenceTopLevel(signature: IdSignature, kind: IrDeserializer.TopLevelSymbolKind, moduleDescriptor: ModuleDescriptor): IrSymbol?
|
||||
}
|
||||
|
||||
+22
@@ -20,6 +20,8 @@ import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.ir.util.ReferenceSymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.TypeTranslator
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
@@ -140,6 +142,26 @@ open class IrPluginContextImpl constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun referenceClass(classId: ClassId): IrClassSymbol? {
|
||||
return referenceClass(classId.asSingleFqName())
|
||||
}
|
||||
|
||||
override fun referenceTypeAlias(classId: ClassId): IrTypeAliasSymbol? {
|
||||
return referenceTypeAlias(classId.asSingleFqName())
|
||||
}
|
||||
|
||||
override fun referenceConstructors(classId: ClassId): Collection<IrConstructorSymbol> {
|
||||
return referenceConstructors(classId.asSingleFqName())
|
||||
}
|
||||
|
||||
override fun referenceFunctions(callableId: CallableId): Collection<IrSimpleFunctionSymbol> {
|
||||
return referenceFunctions(callableId.asSingleFqName())
|
||||
}
|
||||
|
||||
override fun referenceProperties(callableId: CallableId): Collection<IrPropertySymbol> {
|
||||
return referenceProperties(callableId.asSingleFqName())
|
||||
}
|
||||
|
||||
override fun referenceTopLevel(
|
||||
signature: IdSignature,
|
||||
kind: IrDeserializer.TopLevelSymbolKind,
|
||||
|
||||
Reference in New Issue
Block a user