Chromium Code Reviews| OLD | NEW |
|---|---|
| 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('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 // Filters so that [f] is only invoked with instance fields. | 818 // Filters so that [f] is only invoked with instance fields. |
| 819 void fieldFilter(ClassElement enclosingClass, Element member) { | 819 void fieldFilter(ClassElement enclosingClass, Element member) { |
| 820 if (member.isInstanceMember() && member.kind == ElementKind.FIELD) { | 820 if (member.isInstanceMember() && member.kind == ElementKind.FIELD) { |
| 821 f(enclosingClass, member); | 821 f(enclosingClass, member); |
| 822 } | 822 } |
| 823 } | 823 } |
| 824 | 824 |
| 825 forEachMember(fieldFilter, includeBackendMembers, includeSuperMembers); | 825 forEachMember(fieldFilter, includeBackendMembers, includeSuperMembers); |
| 826 } | 826 } |
| 827 | 827 |
| 828 bool implementsInterface(ClassElement intrface) { | |
| 829 assert(intrface.isInterface()); | |
|
ahe
2012/04/10 14:30:38
I don't think this assertion is correct. We have i
floitsch
2012/04/11 11:40:56
Done.
| |
| 830 if (allSupertypes === null) { | |
|
ahe
2012/04/10 14:30:38
I don't understand why this is better than a null
floitsch
2012/04/11 11:40:56
removed.
| |
| 831 throw "internal error: implementsInterface with allSupertypes == null."; | |
|
ahe
2012/04/10 14:30:38
Long line: trailing whitespace?
floitsch
2012/04/11 11:40:56
removed.
| |
| 832 } | |
| 833 for (Type implementedInterfaceType in allSupertypes) { | |
| 834 ClassElement implementedInterface = implementedInterfaceType.element; | |
| 835 if (implementedInterface == intrface) { | |
|
ahe
2012/04/10 14:30:38
Use ===, not ==.
floitsch
2012/04/11 11:40:56
Done.
| |
| 836 return true; | |
| 837 } | |
| 838 } | |
| 839 return false; | |
| 840 } | |
| 841 | |
| 828 bool isInterface() => false; | 842 bool isInterface() => false; |
| 829 bool isNative() => nativeName != null; | 843 bool isNative() => nativeName != null; |
| 830 SourceString nativeName; | 844 SourceString nativeName; |
| 831 } | 845 } |
| 832 | 846 |
| 833 class Elements { | 847 class Elements { |
| 834 static bool isLocal(Element element) { | 848 static bool isLocal(Element element) { |
| 835 return ((element !== null) | 849 return ((element !== null) |
| 836 && !element.isInstanceMember() | 850 && !element.isInstanceMember() |
| 837 && !isStaticOrTopLevelField(element) | 851 && !isStaticOrTopLevelField(element) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1006 final Node node; | 1020 final Node node; |
| 1007 Type bound; | 1021 Type bound; |
| 1008 Type type; | 1022 Type type; |
| 1009 TypeVariableElement(name, Element enclosing, this.node, this.type, | 1023 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 1010 [this.bound]) | 1024 [this.bound]) |
| 1011 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1025 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1012 Type computeType(compiler) => type; | 1026 Type computeType(compiler) => type; |
| 1013 Node parseNode(compiler) => node; | 1027 Node parseNode(compiler) => node; |
| 1014 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1028 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1015 } | 1029 } |
| OLD | NEW |