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

Unified Diff: dart/lib/compiler/implementation/elements/elements.dart

Issue 10661029: Ensure interfaces are loaded. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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
Index: dart/lib/compiler/implementation/elements/elements.dart
diff --git a/dart/lib/compiler/implementation/elements/elements.dart b/dart/lib/compiler/implementation/elements/elements.dart
index 432d835a3f4c120c8dc82a4093bea074d2af20cf..5a05bacced371c4e6b5710e287166ff85885efcd 100644
--- a/dart/lib/compiler/implementation/elements/elements.dart
+++ b/dart/lib/compiler/implementation/elements/elements.dart
@@ -440,8 +440,9 @@ class TypedefElement extends Element implements TypeDeclarationElement {
Type computeType(Compiler compiler) {
if (cachedType !== null) return cachedType;
- cachedType = compiler.computeFunctionType(
- this, compiler.resolveTypedef(this));
+ cachedType = new FunctionType(null, null, this);
+ cachedType.initializeFrom(
+ compiler.computeFunctionType(this, compiler.resolveTypedef(this)));
return cachedType;
}
@@ -883,6 +884,9 @@ class ClassElement extends ContainerElement
Link<Type> interfaces = const EmptyLink<Type>();
bool isResolved = false;
bool isBeingResolved = false;
+ bool isLoadingSupertypes = false;
+ bool supertypesAreLoaded = false;
Lasse Reichstein Nielsen 2012/08/07 09:02:17 Should we consider some kind of "state" type with
+
// backendMembers are members that have been added by the backend to simplify
// compilation. They don't have any user-side counter-part.
Link<Element> backendMembers = const EmptyLink<Element>();
@@ -921,7 +925,12 @@ class ClassElement extends ContainerElement
Link<Type> get typeVariables() => type.arguments;
ClassElement ensureResolved(Compiler compiler) {
- compiler.resolveClass(this);
+ if (!isResolved && !isBeingResolved) {
+ isBeingResolved = true;
+ compiler.resolver.resolveClass(this);
Lasse Reichstein Nielsen 2012/08/07 09:02:17 This looks like the job for a work queue. Can't w
+ isBeingResolved = false;
+ isResolved = true;
+ }
return this;
}
@@ -939,9 +948,25 @@ class ClassElement extends ContainerElement
if (e.modifiers.isStatic()) continue;
return e;
}
+ if (isInterface()) {
+ return lookupSuperInterfaceMember(memberName, getLibrary());
+ }
return null;
}
+ Element lookupSuperInterfaceMember(SourceString memberName,
+ LibraryElement fromLibrary) {
+ for (Type t in interfaces) {
+ Element e = t.element.lookupLocalMember(memberName);
+ if (e === null) continue;
+ // Private members from a different library are not visible.
+ if (memberName.isPrivate() && fromLibrary !== e.getLibrary()) continue;
+ // Static members are not inherited.
+ if (e.modifiers.isStatic()) continue;
+ return e;
+ }
+ }
+
/**
* Find the first member in the class chain with the given
* [memberName]. This method is NOT to be used for resolving

Powered by Google App Engine
This is Rietveld 408576698