FIR deserializer: signature-aware annotation loading for constructors

This commit is contained in:
Jinseong Jeon
2020-06-12 14:47:36 -07:00
committed by Denis Zharkov
parent 955c7a1e5b
commit 12181e55c0
6 changed files with 29 additions and 9 deletions
@@ -87,7 +87,12 @@ abstract class AbstractAnnotationDeserializer(
return annotations.map { deserializeAnnotation(it, nameResolver) }
}
fun loadConstructorAnnotations(constructorProto: ProtoBuf.Constructor, nameResolver: NameResolver): List<FirAnnotationCall> {
open fun loadConstructorAnnotations(
containerSource: DeserializedContainerSource?,
constructorProto: ProtoBuf.Constructor,
nameResolver: NameResolver,
typeTable: TypeTable
): List<FirAnnotationCall> {
if (!Flags.HAS_ANNOTATIONS.get(constructorProto.flags)) return emptyList()
val annotations = constructorProto.getExtension(protocol.constructorAnnotation).orEmpty()
return annotations.map { deserializeAnnotation(it, nameResolver) }
@@ -371,7 +371,8 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
valueParameters += local.memberDeserializer.valueParameters(
proto.valueParameterList, addDefaultValue = classBuilder.symbol.classId == StandardClassIds.Enum
)
annotations += local.annotationDeserializer.loadConstructorAnnotations(proto, local.nameResolver)
annotations +=
c.annotationDeserializer.loadConstructorAnnotations(c.containerSource, proto, local.nameResolver, local.typeTable)
}.build()
}