CallableClsStubBuilder: correctly decide whether callable is extension
This commit is contained in:
+2
-2
@@ -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)
|
||||
|
||||
+4
@@ -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
|
||||
|
||||
+3
-6
@@ -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<out PsiElement>,
|
||||
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user