| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 bool implementsInterface(ClassElement intrface) { | 839 bool implementsInterface(ClassElement intrface) { |
| 840 for (Type implementedInterfaceType in allSupertypes) { | 840 for (Type implementedInterfaceType in allSupertypes) { |
| 841 ClassElement implementedInterface = implementedInterfaceType.element; | 841 ClassElement implementedInterface = implementedInterfaceType.element; |
| 842 if (implementedInterface === intrface) { | 842 if (implementedInterface === intrface) { |
| 843 return true; | 843 return true; |
| 844 } | 844 } |
| 845 } | 845 } |
| 846 return false; | 846 return false; |
| 847 } | 847 } |
| 848 | 848 |
| 849 /** |
| 850 * Returns true if [this] is a subclass of [cls]. |
| 851 * |
| 852 * This method is not to be used for checking type hierarchy and |
| 853 * assignments, because it does not take parameterized types into |
| 854 * account. |
| 855 */ |
| 856 bool isSubclassOf(ClassElement cls) { |
| 857 for (ClassElement s = this; s != null; s = s.superclass) { |
| 858 if (s === cls) return true; |
| 859 } |
| 860 return false; |
| 861 } |
| 862 |
| 849 bool isInterface() => false; | 863 bool isInterface() => false; |
| 850 bool isNative() => nativeName != null; | 864 bool isNative() => nativeName != null; |
| 851 SourceString nativeName; | 865 SourceString nativeName; |
| 852 } | 866 } |
| 853 | 867 |
| 854 class Elements { | 868 class Elements { |
| 855 static bool isLocal(Element element) { | 869 static bool isLocal(Element element) { |
| 856 return ((element !== null) | 870 return ((element !== null) |
| 857 && !element.isInstanceMember() | 871 && !element.isInstanceMember() |
| 858 && !isStaticOrTopLevelField(element) | 872 && !isStaticOrTopLevelField(element) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 final Node node; | 1041 final Node node; |
| 1028 Type bound; | 1042 Type bound; |
| 1029 Type type; | 1043 Type type; |
| 1030 TypeVariableElement(name, Element enclosing, this.node, this.type, | 1044 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 1031 [this.bound]) | 1045 [this.bound]) |
| 1032 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1046 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1033 Type computeType(compiler) => type; | 1047 Type computeType(compiler) => type; |
| 1034 Node parseNode(compiler) => node; | 1048 Node parseNode(compiler) => node; |
| 1035 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1049 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1036 } | 1050 } |
| OLD | NEW |