Add location parameter to JetScope::getProperties
This commit is contained in:
+2
-1
@@ -40,6 +40,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindExclude.NonExtensions
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl
|
||||
import org.jetbrains.kotlin.resolve.scopes.Location
|
||||
import org.jetbrains.kotlin.storage.NotNullLazyValue
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
@@ -296,7 +297,7 @@ public abstract class LazyJavaMemberScope(
|
||||
return propertyType
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name): Collection<VariableDescriptor> = properties(name)
|
||||
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> = properties(name)
|
||||
|
||||
override fun getOwnDeclaredDescriptors() = getDescriptors()
|
||||
|
||||
|
||||
+17
-11
@@ -16,18 +16,24 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.java.lazy.descriptors
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.name.*
|
||||
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaPackage
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||
import org.jetbrains.kotlin.load.java.lazy.findClassInJava
|
||||
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptorKindExclude
|
||||
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
||||
import org.jetbrains.kotlin.load.java.lazy.findClassInJava
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaPackage
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
|
||||
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.Location
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
|
||||
public class LazyPackageFragmentScopeForJavaPackage(
|
||||
c: LazyJavaResolverContext,
|
||||
@@ -66,7 +72,7 @@ public class LazyPackageFragmentScopeForJavaPackage(
|
||||
|
||||
override fun getClassifier(name: Name): ClassifierDescriptor? = classes(name)
|
||||
|
||||
override fun getProperties(name: Name) = deserializedPackageScope().getProperties(name)
|
||||
override fun getProperties(name: Name, location: Location) = deserializedPackageScope().getProperties(name)
|
||||
override fun getFunctions(name: Name) = deserializedPackageScope().getFunctions(name) + super.getFunctions(name)
|
||||
|
||||
override fun addExtraDescriptors(result: MutableSet<DeclarationDescriptor>,
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.OverridingUtil
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl
|
||||
import org.jetbrains.kotlin.resolve.scopes.Location
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
@@ -51,7 +52,7 @@ class FunctionClassScope(
|
||||
return allDescriptors().filterIsInstance<FunctionDescriptor>().filter { it.getName() == name }
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name): Collection<VariableDescriptor> {
|
||||
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> {
|
||||
return allDescriptors().filterIsInstance<PropertyDescriptor>().filter { it.getName() == name }
|
||||
}
|
||||
|
||||
|
||||
+4
-7
@@ -25,10 +25,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorFactory;
|
||||
import org.jetbrains.kotlin.resolve.OverridingUtil;
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl;
|
||||
import org.jetbrains.kotlin.resolve.scopes.StaticScopeForKotlinClass;
|
||||
import org.jetbrains.kotlin.resolve.scopes.*;
|
||||
import org.jetbrains.kotlin.storage.MemoizedFunctionToNotNull;
|
||||
import org.jetbrains.kotlin.storage.NotNullLazyValue;
|
||||
import org.jetbrains.kotlin.storage.StorageManager;
|
||||
@@ -195,14 +192,14 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
||||
@NotNull
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||
public Collection<VariableDescriptor> getProperties(@NotNull Name name, @NotNull Location location) {
|
||||
return (Collection) properties.invoke(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@SuppressWarnings("unchecked")
|
||||
private Collection<PropertyDescriptor> computeProperties(@NotNull Name name) {
|
||||
return resolveFakeOverrides(name, (Collection) getSupertypeScope().getProperties(name));
|
||||
return resolveFakeOverrides(name, (Collection) getSupertypeScope().getProperties(name, Location.NOWHERE));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -270,7 +267,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
||||
Collection<DeclarationDescriptor> result = new HashSet<DeclarationDescriptor>();
|
||||
for (Name name : enumMemberNames.invoke()) {
|
||||
result.addAll(getFunctions(name));
|
||||
result.addAll(getProperties(name));
|
||||
result.addAll(getProperties(name, Location.NOWHERE));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class AbstractScopeAdapter : JetScope {
|
||||
return workerScope.getClassifier(name)
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name): Collection<VariableDescriptor> {
|
||||
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> {
|
||||
return workerScope.getProperties(name)
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public open class ChainedScope(
|
||||
override fun getPackage(name: Name): PackageViewDescriptor?
|
||||
= getFirstMatch { it.getPackage(name) }
|
||||
|
||||
override fun getProperties(name: Name): Collection<VariableDescriptor>
|
||||
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor>
|
||||
= getFromAllScopes { it.getProperties(name) }
|
||||
|
||||
override fun getLocalVariable(name: Name): VariableDescriptor?
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ExplicitImportsScope(private val descriptors: Collection<Declaratio
|
||||
|
||||
override fun getPackage(name: Name)= descriptors.filter { it.getName() == name }.firstIsInstanceOrNull<PackageViewDescriptor>()
|
||||
|
||||
override fun getProperties(name: Name) = descriptors.filter { it.getName() == name }.filterIsInstance<VariableDescriptor>()
|
||||
override fun getProperties(name: Name, location: Location) = descriptors.filter { it.getName() == name }.filterIsInstance<VariableDescriptor>()
|
||||
|
||||
override fun getFunctions(name: Name) = descriptors.filter { it.getName() == name }.filterIsInstance<FunctionDescriptor>()
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class FilteringScope(private val workerScope: JetScope, private val predi
|
||||
|
||||
override fun getClassifier(name: Name) = filterDescriptor(workerScope.getClassifier(name))
|
||||
|
||||
override fun getProperties(name: Name) = workerScope.getProperties(name).filter(predicate)
|
||||
override fun getProperties(name: Name, location: Location) = workerScope.getProperties(name).filter(predicate)
|
||||
|
||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> = workerScope.getSyntheticExtensionProperties(receiverTypes, name).filter(predicate)
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public interface JetScope {
|
||||
|
||||
public fun getPackage(name: Name): PackageViewDescriptor?
|
||||
|
||||
public fun getProperties(name: Name): Collection<VariableDescriptor>
|
||||
public fun getProperties(name: Name, location: Location = Location.NOWHERE): Collection<VariableDescriptor>
|
||||
|
||||
public fun getLocalVariable(name: Name): VariableDescriptor?
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.utils.Printer
|
||||
public abstract class JetScopeImpl : JetScope {
|
||||
override fun getClassifier(name: Name): ClassifierDescriptor? = null
|
||||
|
||||
override fun getProperties(name: Name): Collection<VariableDescriptor> = setOf()
|
||||
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> = setOf()
|
||||
|
||||
override fun getLocalVariable(name: Name): VariableDescriptor? = null
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
|
||||
return result
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name) = substitute(workerScope.getProperties(name))
|
||||
override fun getProperties(name: Name, location: Location) = substitute(workerScope.getProperties(name))
|
||||
|
||||
override fun getLocalVariable(name: Name) = substitute(workerScope.getLocalVariable(name))
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.descriptors.impl.*;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.Location;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.types.error.ErrorSimpleFunctionDescriptorImpl;
|
||||
import org.jetbrains.kotlin.utils.Printer;
|
||||
@@ -87,7 +88,7 @@ public class ErrorUtils {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||
public Set<VariableDescriptor> getProperties(@NotNull Name name, @NotNull Location location) {
|
||||
return ERROR_VARIABLE_GROUP;
|
||||
}
|
||||
|
||||
@@ -191,7 +192,7 @@ public class ErrorUtils {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||
public Collection<VariableDescriptor> getProperties(@NotNull Name name, @NotNull Location location) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -20,11 +20,11 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl
|
||||
import org.jetbrains.kotlin.resolve.scopes.Location
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind
|
||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationContext
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
import java.util.ArrayList
|
||||
@@ -104,7 +104,7 @@ public abstract class DeserializedMemberScope protected constructor(
|
||||
protected open fun computeNonDeclaredProperties(name: Name, descriptors: MutableCollection<PropertyDescriptor>) {
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name): Collection<VariableDescriptor> = properties.invoke(name)
|
||||
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> = properties.invoke(name)
|
||||
|
||||
override fun getClassifier(name: Name) = getClassDescriptor(name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user