K2: support DELEGATION member kind for properties #KT-62581 Fixed

This commit is contained in:
Mikhail Glukhikh
2023-10-23 12:19:02 +02:00
committed by Space Team
parent 19bf11f041
commit d42ae35624
4 changed files with 10 additions and 49 deletions
@@ -440,7 +440,7 @@ class FirElementSerializer private constructor(
hasAnnotations,
ProtoEnumFlags.visibility(normalizeVisibility(property)),
ProtoEnumFlags.modality(modality),
ProtoBuf.MemberKind.DECLARATION,
property.memberKind(),
property.isVar, hasGetter, hasSetter, hasConstant, property.isConst, property.isLateInit,
property.isExternal, property.delegateFieldSymbol != null, property.isExpect
)
@@ -492,6 +492,13 @@ class FirElementSerializer private constructor(
return builder
}
private fun FirProperty.memberKind(): MemberKind {
return when (origin) {
FirDeclarationOrigin.Delegated -> MemberKind.DELEGATION
else -> MemberKind.DECLARATION
}
}
fun functionProto(function: FirFunction): ProtoBuf.Function.Builder? = whileAnalysing(session, function) {
val builder = ProtoBuf.Function.newBuilder()
val simpleFunction = function as? FirSimpleFunction