Refine return type of MemberScope.getContributedFunctions

This commit is contained in:
Denis Zharkov
2016-03-11 15:50:21 +03:00
parent 50d258e7f4
commit 78c9dffe00
26 changed files with 81 additions and 63 deletions
@@ -139,7 +139,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
return lowSixBits + rest
}
fun loadFunction(proto: ProtoBuf.Function): FunctionDescriptor {
fun loadFunction(proto: ProtoBuf.Function): SimpleFunctionDescriptor {
val flags = if (proto.hasFlags()) proto.flags else loadOldFlags(proto.oldFlags)
val annotations = getAnnotations(proto, flags, AnnotatedCallableKind.FUNCTION)
val receiverAnnotations = if (proto.hasReceiver())
@@ -203,8 +203,8 @@ class DeserializedClassDescriptor(
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> = allDescriptors()
override fun computeNonDeclaredFunctions(name: Name, functions: MutableCollection<FunctionDescriptor>) {
val fromSupertypes = ArrayList<FunctionDescriptor>()
override fun computeNonDeclaredFunctions(name: Name, functions: MutableCollection<SimpleFunctionDescriptor>) {
val fromSupertypes = ArrayList<SimpleFunctionDescriptor>()
for (supertype in classDescriptor.getTypeConstructor().supertypes) {
fromSupertypes.addAll(supertype.memberScope.getContributedFunctions(name, NoLookupLocation.FOR_ALREADY_TRACKED))
}
@@ -48,7 +48,7 @@ abstract class DeserializedMemberScope protected constructor(
}
private val functions =
c.storageManager.createMemoizedFunction<Name, Collection<FunctionDescriptor>> { computeFunctions(it) }
c.storageManager.createMemoizedFunction<Name, Collection<SimpleFunctionDescriptor>> { computeFunctions(it) }
private val properties =
c.storageManager.createMemoizedFunction<Name, Collection<PropertyDescriptor>> { computeProperties(it) }
@@ -63,7 +63,7 @@ abstract class DeserializedMemberScope protected constructor(
return map
}
private fun computeFunctions(name: Name): Collection<FunctionDescriptor> {
private fun computeFunctions(name: Name): Collection<SimpleFunctionDescriptor> {
val protos = functionProtos()[ProtoKey(name, isExtension = false)].orEmpty() +
functionProtos()[ProtoKey(name, isExtension = true)].orEmpty()
@@ -75,10 +75,10 @@ abstract class DeserializedMemberScope protected constructor(
return descriptors.toReadOnlyList()
}
protected open fun computeNonDeclaredFunctions(name: Name, functions: MutableCollection<FunctionDescriptor>) {
protected open fun computeNonDeclaredFunctions(name: Name, functions: MutableCollection<SimpleFunctionDescriptor>) {
}
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<SimpleFunctionDescriptor> {
recordLookup(name, location)
return functions(name)
}