Renamed methods in MemberScope from getSmth to getContributedSmth
This commit is contained in:
+1
-1
@@ -65,7 +65,7 @@ public class LazyJavaPackageFragmentProvider(
|
||||
|
||||
javaClass.outerClass?.let { outerClass ->
|
||||
val outerClassScope = resolveClass(outerClass)?.unsubstitutedInnerClassesScope
|
||||
return outerClassScope?.getClassifier(javaClass.name, NoLookupLocation.FROM_JAVA_LOADER) as? ClassDescriptor
|
||||
return outerClassScope?.getContributedClassifier(javaClass.name, NoLookupLocation.FROM_JAVA_LOADER) as? ClassDescriptor
|
||||
}
|
||||
|
||||
val kotlinResult = c.resolveKotlinBinaryClass(c.components.kotlinClassFinder.findKotlinClass(javaClass))
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ class LazyJavaAnnotationDescriptor(
|
||||
//TODO: (module refactoring) moduleClassResolver should be used here
|
||||
val enumClass = c.javaClassResolver.resolveClass(containingJavaClass) ?: return null
|
||||
|
||||
val classifier = enumClass.getUnsubstitutedInnerClassesScope().getClassifier(element.getName(), NoLookupLocation.FROM_JAVA_LOADER)
|
||||
val classifier = enumClass.getUnsubstitutedInnerClassesScope().getContributedClassifier(element.getName(), NoLookupLocation.FROM_JAVA_LOADER)
|
||||
if (classifier !is ClassDescriptor) return null
|
||||
|
||||
return factory.createEnumValue(classifier)
|
||||
|
||||
+4
-4
@@ -302,7 +302,7 @@ public class LazyJavaClassMemberScope(
|
||||
|
||||
private fun getFunctionsFromSupertypes(name: Name): Set<SimpleFunctionDescriptor> {
|
||||
return getContainingDeclaration().typeConstructor.supertypes.flatMap {
|
||||
it.memberScope.getFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { f -> f as SimpleFunctionDescriptor }
|
||||
it.memberScope.getContributedFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { f -> f as SimpleFunctionDescriptor }
|
||||
}.toSet()
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ public class LazyJavaClassMemberScope(
|
||||
|
||||
private fun getPropertiesFromSupertypes(name: Name): Set<PropertyDescriptor> {
|
||||
return getContainingDeclaration().typeConstructor.supertypes.flatMap {
|
||||
it.memberScope.getProperties(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { p -> p }
|
||||
it.memberScope.getContributedVariables(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { p -> p }
|
||||
}.toSet()
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ public class LazyJavaClassMemberScope(
|
||||
override fun getDispatchReceiverParameter(): ReceiverParameterDescriptor? =
|
||||
DescriptorUtils.getDispatchReceiverParameterIfNeeded(getContainingDeclaration())
|
||||
|
||||
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||
recordLookup(name, location)
|
||||
return nestedClasses(name)
|
||||
}
|
||||
@@ -628,7 +628,7 @@ public class LazyJavaClassMemberScope(
|
||||
|
||||
return memberIndex().getAllFieldNames() +
|
||||
getContainingDeclaration().getTypeConstructor().getSupertypes().flatMapTo(LinkedHashSet<Name>()) { supertype ->
|
||||
supertype.getMemberScope().getDescriptors(kindFilter, nameFilter).map { variable ->
|
||||
supertype.getMemberScope().getContributedDescriptors(kindFilter, nameFilter).map { variable ->
|
||||
variable.getName()
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -99,29 +99,29 @@ public class LazyJavaPackageScope(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||
if (!SpecialNames.isSafeIdentifier(name)) return null
|
||||
|
||||
recordLookup(name, location)
|
||||
return classes(name)
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
|
||||
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
|
||||
// We should track lookups here because this scope can be used for kotlin packages too (if it doesn't contain toplevel properties nor functions).
|
||||
recordLookup(name, location)
|
||||
return deserializedPackageScope().getProperties(name, NoLookupLocation.FOR_ALREADY_TRACKED)
|
||||
return deserializedPackageScope().getContributedVariables(name, NoLookupLocation.FOR_ALREADY_TRACKED)
|
||||
}
|
||||
|
||||
override fun getFunctions(name: Name, location: LookupLocation): List<FunctionDescriptor> {
|
||||
override fun getContributedFunctions(name: Name, location: LookupLocation): List<FunctionDescriptor> {
|
||||
// We should track lookups here because this scope can be used for kotlin packages too (if it doesn't contain toplevel properties nor functions).
|
||||
recordLookup(name, location)
|
||||
return deserializedPackageScope().getFunctions(name, NoLookupLocation.FOR_ALREADY_TRACKED) + super.getFunctions(name, NoLookupLocation.FOR_ALREADY_TRACKED)
|
||||
return deserializedPackageScope().getContributedFunctions(name, NoLookupLocation.FOR_ALREADY_TRACKED) + super.getContributedFunctions(name, NoLookupLocation.FOR_ALREADY_TRACKED)
|
||||
}
|
||||
|
||||
override fun addExtraDescriptors(result: MutableSet<DeclarationDescriptor>,
|
||||
kindFilter: DescriptorKindFilter,
|
||||
nameFilter: (Name) -> Boolean) {
|
||||
result.addAll(deserializedPackageScope().getDescriptors(kindFilter, nameFilter))
|
||||
result.addAll(deserializedPackageScope().getContributedDescriptors(kindFilter, nameFilter))
|
||||
}
|
||||
|
||||
override fun computeMemberIndex(): MemberIndex = object : MemberIndex by EMPTY_MEMBER_INDEX {
|
||||
@@ -162,7 +162,7 @@ public class LazyJavaPackageScope(
|
||||
override fun getPropertyNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean) = listOf<Name>()
|
||||
|
||||
// we don't use implementation from super which caches all descriptors and does not use filters
|
||||
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
||||
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
||||
return computeDescriptors(kindFilter, nameFilter, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS)
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -214,7 +214,7 @@ public abstract class LazyJavaScope(
|
||||
return ResolvedValueParameters(descriptors, synthesizedNames)
|
||||
}
|
||||
|
||||
override fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
||||
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
||||
recordLookup(name, location)
|
||||
return functions(name)
|
||||
}
|
||||
@@ -298,13 +298,13 @@ public abstract class LazyJavaScope(
|
||||
return propertyType
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
|
||||
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
|
||||
recordLookup(name, location)
|
||||
return properties(name)
|
||||
}
|
||||
|
||||
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
||||
nameFilter: (Name) -> Boolean) = allDescriptors()
|
||||
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter,
|
||||
nameFilter: (Name) -> Boolean) = allDescriptors()
|
||||
|
||||
protected fun computeDescriptors(
|
||||
kindFilter: DescriptorKindFilter,
|
||||
@@ -317,7 +317,7 @@ public abstract class LazyJavaScope(
|
||||
for (name in getClassNames(kindFilter, nameFilter)) {
|
||||
if (nameFilter(name)) {
|
||||
// Null signifies that a class found in Java is not present in Kotlin (e.g. package class)
|
||||
result.addIfNotNull(getClassifier(name, location))
|
||||
result.addIfNotNull(getContributedClassifier(name, location))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -325,7 +325,7 @@ public abstract class LazyJavaScope(
|
||||
if (kindFilter.acceptsKinds(DescriptorKindFilter.FUNCTIONS_MASK) && !kindFilter.excludes.contains(NonExtensions)) {
|
||||
for (name in getFunctionNames(kindFilter, nameFilter)) {
|
||||
if (nameFilter(name)) {
|
||||
result.addAll(getFunctions(name, location))
|
||||
result.addAll(getContributedFunctions(name, location))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public abstract class LazyJavaScope(
|
||||
if (kindFilter.acceptsKinds(DescriptorKindFilter.VARIABLES_MASK) && !kindFilter.excludes.contains(NonExtensions)) {
|
||||
for (name in getPropertyNames(kindFilter, nameFilter)) {
|
||||
if (nameFilter(name)) {
|
||||
result.addAll(getProperties(name, location))
|
||||
result.addAll(getContributedVariables(name, location))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -63,7 +63,8 @@ public class LazyJavaStaticClassScope(
|
||||
memberIndex().getAllFieldNames() + (if (jClass.isEnum) listOf(DescriptorUtils.ENUM_VALUES) else emptyList())
|
||||
|
||||
override fun getClassNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<Name> = listOf()
|
||||
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||
|
||||
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||
// We don't need to track lookups here because we find nested/inner classes in LazyJavaClassMemberScope
|
||||
return null
|
||||
}
|
||||
@@ -113,7 +114,7 @@ public class LazyJavaStaticClassScope(
|
||||
|
||||
private fun getStaticFunctionsFromJavaSuperClasses(name: Name, descriptor: ClassDescriptor): Set<SimpleFunctionDescriptor> {
|
||||
val staticScope = descriptor.getParentJavaStaticClassScope() ?: return emptySet()
|
||||
return staticScope.getFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { it as SimpleFunctionDescriptor }.toSet()
|
||||
return staticScope.getContributedFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { it as SimpleFunctionDescriptor }.toSet()
|
||||
}
|
||||
|
||||
private fun getStaticPropertiesFromJavaSupertypes(name: Name, descriptor: ClassDescriptor): Set<PropertyDescriptor> {
|
||||
@@ -125,7 +126,7 @@ public class LazyJavaStaticClassScope(
|
||||
|
||||
if (staticScope !is LazyJavaStaticClassScope) return getStaticPropertiesFromJavaSupertypes(name, superTypeDescriptor)
|
||||
|
||||
return staticScope.getProperties(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { it }
|
||||
return staticScope.getContributedVariables(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { it }
|
||||
}
|
||||
|
||||
return descriptor.typeConstructor.supertypes.flatMap(::getStaticProperties).toSet()
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ public class BinaryClassAnnotationAndConstantLoaderImpl(
|
||||
private fun enumEntryValue(enumClassId: ClassId, name: Name): ConstantValue<*> {
|
||||
val enumClass = resolveClass(enumClassId)
|
||||
if (enumClass.getKind() == ClassKind.ENUM_CLASS) {
|
||||
val classifier = enumClass.getUnsubstitutedInnerClassesScope().getClassifier(name, NoLookupLocation.FROM_JAVA_LOADER)
|
||||
val classifier = enumClass.getUnsubstitutedInnerClassesScope().getContributedClassifier(name, NoLookupLocation.FROM_JAVA_LOADER)
|
||||
if (classifier is ClassDescriptor) {
|
||||
return factory.createEnumValue(classifier)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user