Delete VariableDescriptorForObject

This commit is contained in:
Alexander Udalov
2013-11-14 21:44:43 +04:00
parent e3fffa6b0b
commit c6cfeec6fc
3 changed files with 9 additions and 45 deletions
@@ -35,6 +35,13 @@ import java.util.Set;
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
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 {
// Only classifier and packages are resolved
ONLY_CLASSES,
@@ -306,13 +313,7 @@ public class QualifiedExpressionResolver {
Collection<DeclarationDescriptor> filteredDescriptors;
if (lookupMode == LookupMode.ONLY_CLASSES) {
filteredDescriptors = Collections2.filter(descriptors, new Predicate<DeclarationDescriptor>() {
@Override
public boolean apply(@Nullable DeclarationDescriptor descriptor) {
return (descriptor instanceof ClassifierDescriptor) ||
(descriptor instanceof NamespaceDescriptor);
}
});
filteredDescriptors = Collections2.filter(descriptors, CLASSIFIERS_AND_NAMESPACES);
}
else {
filteredDescriptors = Sets.newLinkedHashSet();
@@ -322,14 +323,7 @@ public class QualifiedExpressionResolver {
filteredDescriptors.addAll(lookupResult.descriptors);
continue;
}
filteredDescriptors.addAll(Collections2.filter(lookupResult.descriptors, new Predicate<DeclarationDescriptor>() {
@Override
public boolean apply(@Nullable DeclarationDescriptor descriptor) {
return (descriptor instanceof NamespaceDescriptor) ||
(descriptor instanceof ClassifierDescriptor) ||
(descriptor instanceof VariableDescriptorForObject);
}
}));
filteredDescriptors.addAll(Collections2.filter(lookupResult.descriptors, CLASSIFIERS_AND_NAMESPACES));
}
}
if (storeResult) {
@@ -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());
}
}
if (referencedDescriptor instanceof VariableDescriptorForObject) {
ClassDescriptor objectClass = ((VariableDescriptorForObject) referencedDescriptor).getObjectClass();
if (objectClass.getKind() == ClassKind.OBJECT) {
return objectClass;
}
}
return referencedDescriptor;
}