Index: compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java |
diff --git a/compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java b/compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java |
index 3e6b2ae5cdd577acd1b726919851b33d9d09dd59..8f730ba3f4c17af28ccebfaf0ffa2727b942e20a 100644 |
--- a/compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java |
+++ b/compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java |
@@ -268,6 +268,33 @@ class ClassElementImplementation extends AbstractElement implements ClassElement |
return null; |
} |
+ /** |
+ * Looks through all the fields in this class and its supertypes. Look through supertypes |
+ * first, so that we can use this method to find conflicts. |
+ */ |
+ FieldElement lookupField(String name) { |
+ // Look through super classes |
+ try { |
+ if (!isInterface()) { |
+ for (InterfaceType type : getAllSupertypes()) { |
+ if (!type.getElement().isInterface()) { |
+ InterfaceType.Member member = type.lookupMember(name); |
+ if (member != null) { |
+ FieldElement fieldElement = (FieldElement)member.getElement(); |
+ if (ElementKind.of(fieldElement).equals(ElementKind.FIELD) && |
+ !fieldElement.getModifiers().isAbstract()) { |
+ return (FieldElement) member.getElement(); |
+ } |
+ } |
+ } |
+ } |
+ } |
+ } catch (CyclicDeclarationException ignored) { |
+ } catch (DuplicatedInterfaceException ignored) { |
+ } |
+ return lookupLocalField(name); |
+ } |
+ |
MethodElement lookupLocalMethod(String name) { |
Element element = lookupLocalElement(name); |
if (ElementKind.of(element).equals(ElementKind.METHOD)) { |