Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: compiler/java/com/google/dart/compiler/resolver/ClassScope.java

Issue 10539159: Additional fix for issue 2155 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/resolver/ResolverCompilerTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/resolver/ClassScope.java
===================================================================
--- compiler/java/com/google/dart/compiler/resolver/ClassScope.java (revision 8661)
+++ compiler/java/com/google/dart/compiler/resolver/ClassScope.java (working copy)
@@ -6,6 +6,9 @@
import com.google.dart.compiler.type.InterfaceType;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* Lexical scope corresponding to a class body.
*/
@@ -24,18 +27,23 @@
@Override
public Element findElement(LibraryElement inLibrary, String name) {
+ return findElement(inLibrary, name, new HashSet<ClassElement>());
+ }
+
+ protected Element findElement(LibraryElement inLibrary, String name, Set<ClassElement> examinedTypes) {
Element element = super.findElement(inLibrary, name);
if (element != null) {
return element;
}
+ examinedTypes.add(classElement);
InterfaceType superclass = classElement.getSupertype();
if (superclass != null) {
Element enclosing = superclass.getElement().getEnclosingElement();
ClassElement superclassElement = superclass.getElement();
- if (superclassElement != classElement) {
+ if (!examinedTypes.contains(superclassElement)) {
ClassScope scope = new ClassScope(superclassElement,
new Scope("library", (LibraryElement) enclosing));
- element = scope.findElement(inLibrary, name);
+ element = scope.findElement(inLibrary, name, examinedTypes);
switch (ElementKind.of(element)) {
case TYPE_VARIABLE:
return null;
@@ -49,10 +57,10 @@
for (InterfaceType supertype : classElement.getInterfaces()) {
Element enclosing = supertype.getElement().getEnclosingElement();
ClassElement superclassElement = supertype.getElement();
- if (superclassElement != classElement) {
+ if (!examinedTypes.contains(superclassElement)) {
ClassScope scope = new ClassScope(superclassElement,
new Scope("library", (LibraryElement) enclosing));
- element = scope.findElement(inLibrary, name);
+ element = scope.findElement(inLibrary, name, examinedTypes);
if (element != null) {
return element;
}
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/resolver/ResolverCompilerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698