Renamed methods in MemberScope from getSmth to getContributedSmth

This commit is contained in:
Stanislav Erokhin
2015-11-04 14:46:59 +03:00
parent 6f9d9759ce
commit 2c3f58eeb7
104 changed files with 289 additions and 288 deletions
@@ -135,7 +135,7 @@ public class AnnotationDeserializer(private val module: ModuleDescriptor) {
private fun resolveEnumValue(enumClassId: ClassId, enumEntryName: Name): ConstantValue<*> {
val enumClass = resolveClass(enumClassId)
if (enumClass.getKind() == ClassKind.ENUM_CLASS) {
val enumEntry = enumClass.getUnsubstitutedInnerClassesScope().getClassifier(enumEntryName, NoLookupLocation.FROM_DESERIALIZATION)
val enumEntry = enumClass.getUnsubstitutedInnerClassesScope().getContributedClassifier(enumEntryName, NoLookupLocation.FROM_DESERIALIZATION)
if (enumEntry is ClassDescriptor) {
return factory.createEnumValue(enumEntry)
}
@@ -130,7 +130,7 @@ public class DeserializedClassDescriptor(
if (!classProto.hasCompanionObjectName()) return null
val companionObjectName = c.nameResolver.getName(classProto.getCompanionObjectName())
return memberScope.getClassifier(companionObjectName, NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor
return memberScope.getContributedClassifier(companionObjectName, NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor
}
override fun getCompanionObjectDescriptor(): ClassDescriptor? = companionObjectDescriptor()
@@ -192,13 +192,13 @@ public class DeserializedClassDescriptor(
computeDescriptors(DescriptorKindFilter.ALL, MemberScope.ALL_NAME_FILTER, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS)
}
override fun getDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> = allDescriptors()
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter,
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> = allDescriptors()
override fun computeNonDeclaredFunctions(name: Name, functions: MutableCollection<FunctionDescriptor>) {
val fromSupertypes = ArrayList<FunctionDescriptor>()
for (supertype in classDescriptor.getTypeConstructor().supertypes) {
fromSupertypes.addAll(supertype.memberScope.getFunctions(name, NoLookupLocation.FOR_ALREADY_TRACKED))
fromSupertypes.addAll(supertype.memberScope.getContributedFunctions(name, NoLookupLocation.FOR_ALREADY_TRACKED))
}
generateFakeOverrides(name, fromSupertypes, functions)
}
@@ -206,7 +206,7 @@ public class DeserializedClassDescriptor(
override fun computeNonDeclaredProperties(name: Name, descriptors: MutableCollection<PropertyDescriptor>) {
val fromSupertypes = ArrayList<PropertyDescriptor>()
for (supertype in classDescriptor.getTypeConstructor().supertypes) {
fromSupertypes.addAll(supertype.memberScope.getProperties(name, NoLookupLocation.FOR_ALREADY_TRACKED))
fromSupertypes.addAll(supertype.memberScope.getContributedVariables(name, NoLookupLocation.FOR_ALREADY_TRACKED))
}
generateFakeOverrides(name, fromSupertypes, descriptors)
}
@@ -229,12 +229,12 @@ public class DeserializedClassDescriptor(
override fun addNonDeclaredDescriptors(result: MutableCollection<DeclarationDescriptor>, location: LookupLocation) {
for (supertype in classDescriptor.getTypeConstructor().supertypes) {
for (descriptor in supertype.memberScope.getDescriptors()) {
for (descriptor in supertype.memberScope.getContributedDescriptors()) {
if (descriptor is FunctionDescriptor) {
result.addAll(getFunctions(descriptor.name, location))
result.addAll(getContributedFunctions(descriptor.name, location))
}
else if (descriptor is PropertyDescriptor) {
result.addAll(getProperties(descriptor.name, location))
result.addAll(getContributedVariables(descriptor.name, location))
}
// Nothing else is inherited
}
@@ -312,7 +312,7 @@ public class DeserializedClassDescriptor(
val result = HashSet<Name>()
for (supertype in getTypeConstructor().getSupertypes()) {
for (descriptor in supertype.getMemberScope().getDescriptors()) {
for (descriptor in supertype.getMemberScope().getContributedDescriptors()) {
if (descriptor is SimpleFunctionDescriptor || descriptor is PropertyDescriptor) {
result.add(descriptor.getName())
}
@@ -82,7 +82,7 @@ public abstract class DeserializedMemberScope protected constructor(
protected open fun computeNonDeclaredFunctions(name: Name, functions: MutableCollection<FunctionDescriptor>) {
}
override fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
recordLookup(name, location)
return functions(name)
}
@@ -102,12 +102,12 @@ public abstract class DeserializedMemberScope protected constructor(
protected open fun computeNonDeclaredProperties(name: Name, descriptors: MutableCollection<PropertyDescriptor>) {
}
override fun getProperties(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
recordLookup(name, location)
return properties.invoke(name)
}
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
recordLookup(name, location)
return getClassDescriptor(name)
}
@@ -150,12 +150,12 @@ public abstract class DeserializedMemberScope protected constructor(
) {
if (kindFilter.acceptsKinds(DescriptorKindFilter.VARIABLES_MASK)) {
val keys = propertyProtos().keySet().filter { nameFilter(it.name) }
addMembers(result, keys) { getProperties(it, location) }
addMembers(result, keys) { getContributedVariables(it, location) }
}
if (kindFilter.acceptsKinds(DescriptorKindFilter.FUNCTIONS_MASK)) {
val keys = functionProtos().keySet().filter { nameFilter(it.name) }
addMembers(result, keys) { getFunctions(it, location) }
addMembers(result, keys) { getContributedFunctions(it, location) }
}
}
@@ -46,7 +46,7 @@ public open class DeserializedPackageMemberScope(
internal val classNames by c.storageManager.createLazyValue { classNames().toSet() }
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
= computeDescriptors(kindFilter, nameFilter, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS)
override fun getClassDescriptor(name: Name): ClassDescriptor? =
@@ -24,10 +24,10 @@ import org.jetbrains.kotlin.name.ClassId
public fun ModuleDescriptor.findClassAcrossModuleDependencies(classId: ClassId): ClassDescriptor? {
val packageViewDescriptor = getPackage(classId.packageFqName)
val segments = classId.relativeClassName.pathSegments()
val topLevelClass = packageViewDescriptor.memberScope.getClassifier(segments.first(), NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor ?: return null
val topLevelClass = packageViewDescriptor.memberScope.getContributedClassifier(segments.first(), NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor ?: return null
var result = topLevelClass
for (name in segments.subList(1, segments.size())) {
result = result.unsubstitutedInnerClassesScope.getClassifier(name, NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor ?: return null
result = result.unsubstitutedInnerClassesScope.getContributedClassifier(name, NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor ?: return null
}
return result
}