Revert "Add method for getting all classifiers with given name from the scope"
This reverts commit 97759f5bb7.
This commit is contained in:
-7
@@ -160,13 +160,6 @@ public abstract class DeserializedMemberScope implements JetScope {
|
|||||||
return getClassDescriptor(name);
|
return getClassDescriptor(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public final Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
ClassifierDescriptor classifier = getClassifier(name);
|
|
||||||
return classifier != null ? Collections.singleton(classifier) : Collections.<ClassifierDescriptor>emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected abstract ClassifierDescriptor getClassDescriptor(@NotNull Name name);
|
protected abstract ClassifierDescriptor getClassDescriptor(@NotNull Name name);
|
||||||
|
|
||||||
|
|||||||
@@ -244,12 +244,6 @@ public class LazyImportScope implements JetScope {
|
|||||||
return selectFirstFromImports(name, LookupMode.ONLY_CLASSES, JetScopeSelectorUtil.CLASSIFIER_DESCRIPTOR_SCOPE_SELECTOR);
|
return selectFirstFromImports(name, LookupMode.ONLY_CLASSES, JetScopeSelectorUtil.CLASSIFIER_DESCRIPTOR_SCOPE_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
return collectFromImports(name, LookupMode.ONLY_CLASSES, JetScopeSelectorUtil.NAMED_CLASSIFIERS_SCOPE_SELECTOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public PackageViewDescriptor getPackage(@NotNull Name name) {
|
public PackageViewDescriptor getPackage(@NotNull Name name) {
|
||||||
|
|||||||
+6
-12
@@ -46,7 +46,7 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
|||||||
protected final DP declarationProvider;
|
protected final DP declarationProvider;
|
||||||
protected final D thisDescriptor;
|
protected final D thisDescriptor;
|
||||||
|
|
||||||
private final MemoizedFunctionToNotNull<Name, List<ClassifierDescriptor>> classDescriptors;
|
private final MemoizedFunctionToNotNull<Name, List<ClassDescriptor>> classDescriptors;
|
||||||
|
|
||||||
private final MemoizedFunctionToNotNull<Name, Set<FunctionDescriptor>> functionDescriptors;
|
private final MemoizedFunctionToNotNull<Name, Set<FunctionDescriptor>> functionDescriptors;
|
||||||
private final MemoizedFunctionToNotNull<Name, Set<VariableDescriptor>> propertyDescriptors;
|
private final MemoizedFunctionToNotNull<Name, Set<VariableDescriptor>> propertyDescriptors;
|
||||||
@@ -63,9 +63,9 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
|||||||
this.thisDescriptor = thisDescriptor;
|
this.thisDescriptor = thisDescriptor;
|
||||||
|
|
||||||
StorageManager storageManager = resolveSession.getStorageManager();
|
StorageManager storageManager = resolveSession.getStorageManager();
|
||||||
this.classDescriptors = storageManager.createMemoizedFunction(new Function1<Name, List<ClassifierDescriptor>>() {
|
this.classDescriptors = storageManager.createMemoizedFunction(new Function1<Name, List<ClassDescriptor>>() {
|
||||||
@Override
|
@Override
|
||||||
public List<ClassifierDescriptor> invoke(Name name) {
|
public List<ClassDescriptor> invoke(Name name) {
|
||||||
return resolveClassDescriptor(name);
|
return resolveClassDescriptor(name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -92,12 +92,12 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private List<ClassifierDescriptor> resolveClassDescriptor(@NotNull final Name name) {
|
private List<ClassDescriptor> resolveClassDescriptor(@NotNull final Name name) {
|
||||||
Collection<JetClassOrObject> classOrObjectDeclarations = declarationProvider.getClassOrObjectDeclarations(name);
|
Collection<JetClassOrObject> classOrObjectDeclarations = declarationProvider.getClassOrObjectDeclarations(name);
|
||||||
|
|
||||||
return ContainerUtil.mapNotNull(classOrObjectDeclarations, new Function<JetClassOrObject, ClassifierDescriptor>() {
|
return ContainerUtil.mapNotNull(classOrObjectDeclarations, new Function<JetClassOrObject, ClassDescriptor>() {
|
||||||
@Override
|
@Override
|
||||||
public ClassifierDescriptor fun(JetClassOrObject classOrObject) {
|
public ClassDescriptor fun(JetClassOrObject classOrObject) {
|
||||||
return new LazyClassDescriptor(resolveSession, thisDescriptor, name, JetClassInfoUtil.createClassLikeInfo(classOrObject));
|
return new LazyClassDescriptor(resolveSession, thisDescriptor, name, JetClassInfoUtil.createClassLikeInfo(classOrObject));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -108,12 +108,6 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
|||||||
return first(classDescriptors.invoke(name));
|
return first(classDescriptors.invoke(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
return classDescriptors.invoke(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> T first(@NotNull List<T> list) {
|
private static <T> T first(@NotNull List<T> list) {
|
||||||
if (list.isEmpty()) return null;
|
if (list.isEmpty()) return null;
|
||||||
return list.get(0);
|
return list.get(0);
|
||||||
|
|||||||
-2
@@ -272,8 +272,6 @@ public abstract class LazyJavaMemberScope(
|
|||||||
override fun getLocalVariable(name: Name): VariableDescriptor? = null
|
override fun getLocalVariable(name: Name): VariableDescriptor? = null
|
||||||
override fun getDeclarationsByLabel(labelName: LabelName) = listOf<DeclarationDescriptor>()
|
override fun getDeclarationsByLabel(labelName: LabelName) = listOf<DeclarationDescriptor>()
|
||||||
|
|
||||||
override fun getClassifiers(name: Name) = emptyOrSingletonList(getClassifier(name))
|
|
||||||
|
|
||||||
override fun getOwnDeclaredDescriptors() = getAllDescriptors()
|
override fun getOwnDeclaredDescriptors() = getAllDescriptors()
|
||||||
override fun getAllDescriptors() = allDescriptors()
|
override fun getAllDescriptors() = allDescriptors()
|
||||||
|
|
||||||
|
|||||||
@@ -55,12 +55,6 @@ public abstract class AbstractScopeAdapter implements JetScope {
|
|||||||
return getWorkerScope().getClassifier(name);
|
return getWorkerScope().getClassifier(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
return getWorkerScope().getClassifiers(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||||
|
|||||||
@@ -51,12 +51,6 @@ public class ChainedScope implements JetScope {
|
|||||||
return getFirstMatch(scopeChain, name, CLASSIFIER_DESCRIPTOR_SCOPE_SELECTOR);
|
return getFirstMatch(scopeChain, name, CLASSIFIER_DESCRIPTOR_SCOPE_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
return getFromAllScopes(scopeChain, name, NAMED_CLASSIFIERS_SCOPE_SELECTOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PackageViewDescriptor getPackage(@NotNull Name name) {
|
public PackageViewDescriptor getPackage(@NotNull Name name) {
|
||||||
return getFirstMatch(scopeChain, name, PACKAGE_SCOPE_SELECTOR);
|
return getFirstMatch(scopeChain, name, PACKAGE_SCOPE_SELECTOR);
|
||||||
|
|||||||
@@ -66,12 +66,6 @@ public class FilteringScope implements JetScope {
|
|||||||
return filterDescriptor(workerScope.getClassifier(name));
|
return filterDescriptor(workerScope.getClassifier(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
return Collections2.filter(workerScope.getClassifiers(name), predicate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||||
|
|||||||
@@ -53,10 +53,6 @@ public interface JetScope {
|
|||||||
@Nullable
|
@Nullable
|
||||||
ClassifierDescriptor getClassifier(@NotNull Name name);
|
ClassifierDescriptor getClassifier(@NotNull Name name);
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ReadOnly
|
|
||||||
Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name);
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
PackageViewDescriptor getPackage(@NotNull Name name);
|
PackageViewDescriptor getPackage(@NotNull Name name);
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,6 @@ public abstract class JetScopeImpl implements JetScope {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||||
|
|||||||
@@ -112,15 +112,6 @@ public class JetScopeSelectorUtil {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final ScopeByNameMultiSelector<ClassifierDescriptor> NAMED_CLASSIFIERS_SCOPE_SELECTOR =
|
|
||||||
new ScopeByNameMultiSelector<ClassifierDescriptor>() {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> get(@NotNull JetScope scope, @NotNull Name name) {
|
|
||||||
return scope.getClassifiers(name);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final ScopeDescriptorSelector<DeclarationDescriptor> ALL_DESCRIPTORS_SCOPE_SELECTOR =
|
public static final ScopeDescriptorSelector<DeclarationDescriptor> ALL_DESCRIPTORS_SCOPE_SELECTOR =
|
||||||
new ScopeDescriptorSelector<DeclarationDescriptor>() {
|
new ScopeDescriptorSelector<DeclarationDescriptor>() {
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -98,12 +98,6 @@ public class SubstitutingScope implements JetScope {
|
|||||||
return substitute(workerScope.getClassifier(name));
|
return substitute(workerScope.getClassifier(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
return substitute(workerScope.getClassifiers(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||||
|
|||||||
@@ -85,12 +85,6 @@ public class ErrorUtils {
|
|||||||
return ERROR_CLASS;
|
return ERROR_CLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
return ERROR_CLASSIFIER_GROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<VariableDescriptor> getProperties(@NotNull Name name) {
|
public Set<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||||
@@ -167,12 +161,6 @@ public class ErrorUtils {
|
|||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<ClassifierDescriptor> getClassifiers(@NotNull Name name) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public PackageViewDescriptor getPackage(@NotNull Name name) {
|
public PackageViewDescriptor getPackage(@NotNull Name name) {
|
||||||
@@ -266,7 +254,6 @@ public class ErrorUtils {
|
|||||||
ERROR_PROPERTY_TYPE,
|
ERROR_PROPERTY_TYPE,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION);
|
CallableMemberDescriptor.Kind.DECLARATION);
|
||||||
private static final Set<VariableDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
|
private static final Set<VariableDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
|
||||||
private static final Set<ClassifierDescriptor> ERROR_CLASSIFIER_GROUP = Collections.<ClassifierDescriptor>singleton(ERROR_CLASS);
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static SimpleFunctionDescriptor createErrorFunction(@NotNull ErrorScope ownerScope) {
|
private static SimpleFunctionDescriptor createErrorFunction(@NotNull ErrorScope ownerScope) {
|
||||||
|
|||||||
Reference in New Issue
Block a user