CallableClsStubBuilder: correctly decide whether callable is extension

This commit is contained in:
Pavel V. Talanov
2015-12-08 17:45:18 +03:00
parent deb6410a5c
commit fee19ad9de
3 changed files with 9 additions and 8 deletions
@@ -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)
@@ -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