diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt index 8f2ebf524f2..9ba2f356232 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt @@ -52,7 +52,7 @@ public class MemberDeserializer(private val c: DeserializationContext) { val local = c.childContext(property, proto.getTypeParameterList()) val hasGetter = Flags.HAS_GETTER.get(flags) - val receiverAnnotations = if (hasGetter && (proto.hasReceiverType() || proto.hasReceiverTypeId())) + val receiverAnnotations = if (hasGetter && proto.hasReceiver()) getReceiverParameterAnnotations(proto, AnnotatedCallableKind.PROPERTY_GETTER) else Annotations.EMPTY @@ -136,7 +136,7 @@ public class MemberDeserializer(private val c: DeserializationContext) { public fun loadFunction(proto: ProtoBuf.Function): FunctionDescriptor { val annotations = getAnnotations(proto, proto.flags, AnnotatedCallableKind.FUNCTION) - val receiverAnnotations = if (proto.hasReceiverType() || proto.hasReceiverTypeId()) + val receiverAnnotations = if (proto.hasReceiver()) getReceiverParameterAnnotations(proto, AnnotatedCallableKind.FUNCTION) else Annotations.EMPTY val function = DeserializedSimpleFunctionDescriptor.create(c.containingDeclaration, annotations, proto, c.nameResolver, c.typeTable) diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/protoTypeTableUtil.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/protoTypeTableUtil.kt index aeac84531d9..e9336e37ecf 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/protoTypeTableUtil.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/protoTypeTableUtil.kt @@ -47,6 +47,8 @@ fun ProtoBuf.Function.returnType(typeTable: TypeTable): ProtoBuf.Type { return if (hasReturnType()) returnType else typeTable[returnTypeId] } +fun ProtoBuf.Function.hasReceiver(): Boolean = hasReceiverType() || hasReceiverTypeId() + fun ProtoBuf.Function.receiverType(typeTable: TypeTable): ProtoBuf.Type? { return when { hasReceiverType() -> receiverType @@ -59,6 +61,8 @@ fun ProtoBuf.Property.returnType(typeTable: TypeTable): ProtoBuf.Type { return if (hasReturnType()) returnType else typeTable[returnTypeId] } +fun ProtoBuf.Property.hasReceiver(): Boolean = hasReceiverType() || hasReceiverTypeId() + fun ProtoBuf.Property.receiverType(typeTable: TypeTable): ProtoBuf.Type? { return when { hasReceiverType() -> receiverType diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/CallableClsStubBuilder.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/CallableClsStubBuilder.kt index 8bb45b6c609..699d4f26d85 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/CallableClsStubBuilder.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/CallableClsStubBuilder.kt @@ -29,10 +29,7 @@ import org.jetbrains.kotlin.serialization.Flags import org.jetbrains.kotlin.serialization.ProtoBuf import org.jetbrains.kotlin.serialization.ProtoBuf.MemberKind import org.jetbrains.kotlin.serialization.ProtoBuf.Modality -import org.jetbrains.kotlin.serialization.deserialization.AnnotatedCallableKind -import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer -import org.jetbrains.kotlin.serialization.deserialization.receiverType -import org.jetbrains.kotlin.serialization.deserialization.returnType +import org.jetbrains.kotlin.serialization.deserialization.* fun createCallableStubs( parentStub: StubElement, @@ -150,7 +147,7 @@ private class FunctionClsStubBuilder( callableName.ref(), isTopLevel, c.containerFqName.child(callableName), - isExtension = functionProto.hasReceiverType(), + isExtension = functionProto.hasReceiver(), hasBlockBody = true, hasBody = Flags.MODALITY.get(functionProto.flags) != Modality.ABSTRACT, hasTypeParameterListBeforeFunctionName = functionProto.typeParameterList.isNotEmpty() @@ -201,7 +198,7 @@ private class PropertyClsStubBuilder( hasDelegate = false, hasDelegateExpression = false, hasInitializer = false, - isExtension = propertyProto.hasReceiverType(), + isExtension = propertyProto.hasReceiver(), hasReturnTypeRef = true, fqName = c.containerFqName.child(callableName) )