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

Side by Side 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: Rebased 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('elements'); 5 #library('elements');
6 6
7 #import('dart:uri'); 7 #import('dart:uri');
8 8
9 #import('../tree/tree.dart'); 9 #import('../tree/tree.dart');
10 #import('../scanner/scannerlib.dart'); 10 #import('../scanner/scannerlib.dart');
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 bool _isNative = false; 268 bool _isNative = false;
269 void setNative() { _isNative = true; } 269 void setNative() { _isNative = true; }
270 bool isNative() => _isNative; 270 bool isNative() => _isNative;
271 271
272 FunctionElement asFunctionElement() => null; 272 FunctionElement asFunctionElement() => null;
273 273
274 Element cloneTo(Element enclosing, DiagnosticListener listener) { 274 Element cloneTo(Element enclosing, DiagnosticListener listener) {
275 listener.cancel("Unimplemented cloneTo", element: this); 275 listener.cancel("Unimplemented cloneTo", element: this);
276 } 276 }
277
278 Link<Type> get allSupertypesAndSelf() {
279 return allSupertypes.prepend(new InterfaceType(this));
280 }
277 } 281 }
278 282
279 class ContainerElement extends Element { 283 class ContainerElement extends Element {
280 Link<Element> localMembers = const EmptyLink<Element>(); 284 Link<Element> localMembers = const EmptyLink<Element>();
281 285
282 ContainerElement(name, kind, enclosingElement) 286 ContainerElement(name, kind, enclosingElement)
283 : super(name, kind, enclosingElement); 287 : super(name, kind, enclosingElement);
284 288
285 void addMember(Element element, DiagnosticListener listener) { 289 void addMember(Element element, DiagnosticListener listener) {
286 localMembers = localMembers.prepend(element); 290 localMembers = localMembers.prepend(element);
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 bool isPrivate = memberName.isPrivate(); 1063 bool isPrivate = memberName.isPrivate();
1060 for (ClassElement s = superclass; s != null; s = s.superclass) { 1064 for (ClassElement s = superclass; s != null; s = s.superclass) {
1061 // Private members from a different library are not visible. 1065 // Private members from a different library are not visible.
1062 if (isPrivate && getLibrary() !== s.getLibrary()) continue; 1066 if (isPrivate && getLibrary() !== s.getLibrary()) continue;
1063 Element e = s.lookupLocalMember(memberName); 1067 Element e = s.lookupLocalMember(memberName);
1064 if (e === null) continue; 1068 if (e === null) continue;
1065 // Static members are not inherited. 1069 // Static members are not inherited.
1066 if (e.modifiers.isStatic()) continue; 1070 if (e.modifiers.isStatic()) continue;
1067 return e; 1071 return e;
1068 } 1072 }
1073 if (isInterface()) {
1074 return lookupSuperInterfaceMember(memberName, getLibrary());
1075 }
1076 return null;
1077 }
1078
1079 Element lookupSuperInterfaceMember(SourceString memberName,
1080 LibraryElement fromLibrary) {
1081 bool isPrivate = memberName.isPrivate();
1082 for (Type t in interfaces) {
1083 Element e = t.element.lookupLocalMember(memberName);
1084 if (e === null) continue;
1085 // Private members from a different library are not visible.
1086 if (isPrivate && fromLibrary !== e.getLibrary()) continue;
1087 // Static members are not inherited.
1088 if (e.modifiers.isStatic()) continue;
1089 return e;
1090 }
1069 return null; 1091 return null;
1070 } 1092 }
1071 1093
1072 /** 1094 /**
1073 * Find the first member in the class chain with the given 1095 * Find the first member in the class chain with the given
1074 * [memberName]. This method is NOT to be used for resolving 1096 * [memberName]. This method is NOT to be used for resolving
1075 * unqualified sends because it does not implement the scoping 1097 * unqualified sends because it does not implement the scoping
1076 * rules, where library scope comes before superclass scope. 1098 * rules, where library scope comes before superclass scope.
1077 */ 1099 */
1078 Element lookupMember(SourceString memberName) { 1100 Element lookupMember(SourceString memberName) {
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 Node parseNode(compiler) => cachedNode; 1449 Node parseNode(compiler) => cachedNode;
1428 1450
1429 String toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1451 String toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1430 1452
1431 TypeVariableElement cloneTo(Element enclosing, DiagnosticListener listener) { 1453 TypeVariableElement cloneTo(Element enclosing, DiagnosticListener listener) {
1432 TypeVariableElement result = 1454 TypeVariableElement result =
1433 new TypeVariableElement(name, enclosing, node, type, bound); 1455 new TypeVariableElement(name, enclosing, node, type, bound);
1434 return result; 1456 return result;
1435 } 1457 }
1436 } 1458 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/closure.dart ('k') | dart/lib/compiler/implementation/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698