Delete VariableDescriptorForObject
This commit is contained in:
+9
-15
@@ -35,6 +35,13 @@ import java.util.Set;
|
|||||||
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
|
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
|
||||||
|
|
||||||
public class QualifiedExpressionResolver {
|
public class QualifiedExpressionResolver {
|
||||||
|
private static final Predicate<DeclarationDescriptor> CLASSIFIERS_AND_NAMESPACES = new Predicate<DeclarationDescriptor>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(@Nullable DeclarationDescriptor descriptor) {
|
||||||
|
return descriptor instanceof ClassifierDescriptor || descriptor instanceof NamespaceDescriptor;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public enum LookupMode {
|
public enum LookupMode {
|
||||||
// Only classifier and packages are resolved
|
// Only classifier and packages are resolved
|
||||||
ONLY_CLASSES,
|
ONLY_CLASSES,
|
||||||
@@ -306,13 +313,7 @@ public class QualifiedExpressionResolver {
|
|||||||
|
|
||||||
Collection<DeclarationDescriptor> filteredDescriptors;
|
Collection<DeclarationDescriptor> filteredDescriptors;
|
||||||
if (lookupMode == LookupMode.ONLY_CLASSES) {
|
if (lookupMode == LookupMode.ONLY_CLASSES) {
|
||||||
filteredDescriptors = Collections2.filter(descriptors, new Predicate<DeclarationDescriptor>() {
|
filteredDescriptors = Collections2.filter(descriptors, CLASSIFIERS_AND_NAMESPACES);
|
||||||
@Override
|
|
||||||
public boolean apply(@Nullable DeclarationDescriptor descriptor) {
|
|
||||||
return (descriptor instanceof ClassifierDescriptor) ||
|
|
||||||
(descriptor instanceof NamespaceDescriptor);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
filteredDescriptors = Sets.newLinkedHashSet();
|
filteredDescriptors = Sets.newLinkedHashSet();
|
||||||
@@ -322,14 +323,7 @@ public class QualifiedExpressionResolver {
|
|||||||
filteredDescriptors.addAll(lookupResult.descriptors);
|
filteredDescriptors.addAll(lookupResult.descriptors);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
filteredDescriptors.addAll(Collections2.filter(lookupResult.descriptors, new Predicate<DeclarationDescriptor>() {
|
filteredDescriptors.addAll(Collections2.filter(lookupResult.descriptors, CLASSIFIERS_AND_NAMESPACES));
|
||||||
@Override
|
|
||||||
public boolean apply(@Nullable DeclarationDescriptor descriptor) {
|
|
||||||
return (descriptor instanceof NamespaceDescriptor) ||
|
|
||||||
(descriptor instanceof ClassifierDescriptor) ||
|
|
||||||
(descriptor instanceof VariableDescriptorForObject);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (storeResult) {
|
if (storeResult) {
|
||||||
|
|||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2013 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.jet.lang.descriptors;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public interface VariableDescriptorForObject extends VariableDescriptor {
|
|
||||||
@NotNull
|
|
||||||
ClassDescriptor getObjectClass();
|
|
||||||
}
|
|
||||||
@@ -83,12 +83,6 @@ public final class DecompiledNavigationUtils {
|
|||||||
return getEffectiveReferencedDescriptor(overriddenDescriptors.iterator().next());
|
return getEffectiveReferencedDescriptor(overriddenDescriptors.iterator().next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (referencedDescriptor instanceof VariableDescriptorForObject) {
|
|
||||||
ClassDescriptor objectClass = ((VariableDescriptorForObject) referencedDescriptor).getObjectClass();
|
|
||||||
if (objectClass.getKind() == ClassKind.OBJECT) {
|
|
||||||
return objectClass;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return referencedDescriptor;
|
return referencedDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user