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

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

Issue 10836235: Check overrides. (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 03895b2087442c5c6508b957b756e0c79043ea58..f111cd254a84bca80cfca2ca26d5131676e4af59 100644
--- a/dart/lib/compiler/implementation/elements/elements.dart
+++ b/dart/lib/compiler/implementation/elements/elements.dart
@@ -275,6 +275,10 @@ class Element implements Hashable {
Element cloneTo(Element enclosing, DiagnosticListener listener) {
listener.cancel("Unimplemented cloneTo", element: this);
}
+
+ Link<Type> get allSupertypesAndSelf() {
+ return allSupertypes.prepend(new InterfaceType(this));
+ }
}
class ContainerElement extends Element {
@@ -1075,9 +1079,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;
karlklose 2012/08/14 11:06:51 You could store the result of memberName.isPrivate
ahe 2012/08/14 18:20:34 Done.
+ // Static members are not inherited.
+ if (e.modifiers.isStatic()) continue;
+ return e;
+ }
+ }
karlklose 2012/08/14 11:06:51 I would prefer an explicit 'return null' here.
ahe 2012/08/14 18:20:34 Done.
+
/**
* Find the first member in the class chain with the given
* [memberName]. This method is NOT to be used for resolving
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/enqueue.dart » ('j') | dart/lib/compiler/implementation/enqueue.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698