FIR deserializer: keep SourceElement for more precise Fir2IrLazyClass's source
This commit is contained in:
committed by
TeamCityServer
parent
fe0c25693d
commit
dea01125d6
+2
@@ -203,6 +203,8 @@ fun deserializeClassToSymbol(
|
||||
context.annotationDeserializer.loadClassAnnotations(classProto, context.nameResolver)
|
||||
|
||||
it.versionRequirementsTable = context.versionRequirementTable
|
||||
|
||||
it.sourceElement = containerSource
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class Fir2IrLazyClass(
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
|
||||
override val source: SourceElement
|
||||
get() = SourceElement.NO_SOURCE
|
||||
get() = fir.sourceElement ?: SourceElement.NO_SOURCE
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassDescriptor
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.declarations
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.FirRegularClassBuilder
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.FirTypeParameterBuilder
|
||||
@@ -128,6 +129,9 @@ fun FirRegularClass.addDeclaration(declaration: FirDeclaration) {
|
||||
}
|
||||
}
|
||||
|
||||
private object SourceElementKey : FirDeclarationDataKey()
|
||||
var FirRegularClass.sourceElement: SourceElement? by FirDeclarationDataRegistry.data(SourceElementKey)
|
||||
|
||||
private object IsFromVarargKey : FirDeclarationDataKey()
|
||||
var FirProperty.isFromVararg: Boolean? by FirDeclarationDataRegistry.data(IsFromVarargKey)
|
||||
private object IsReferredViaField : FirDeclarationDataKey()
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
// No virtual method getAnnotatedReturnType()Ljava/lang/reflect/AnnotatedType
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
Reference in New Issue
Block a user