OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // TODO(sigmund): rename and move to common/elements.dart | 5 // TODO(sigmund): rename and move to common/elements.dart |
6 library dart2js.type_system; | 6 library dart2js.type_system; |
7 | 7 |
8 import 'common/names.dart' show Identifiers, Uris; | 8 import 'common/names.dart' show Identifiers, Uris; |
9 import 'js_backend/constant_system_javascript.dart'; | 9 import 'js_backend/constant_system_javascript.dart'; |
10 import 'elements/types.dart'; | 10 import 'elements/types.dart'; |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 {bool required: false}); | 1176 {bool required: false}); |
1177 | 1177 |
1178 /// Calls [f] for each class member declared or inherited in [cls] together | 1178 /// Calls [f] for each class member declared or inherited in [cls] together |
1179 /// with the class that declared the member. | 1179 /// with the class that declared the member. |
1180 /// | 1180 /// |
1181 /// TODO(johnniwinther): This should not include static members of | 1181 /// TODO(johnniwinther): This should not include static members of |
1182 /// superclasses. | 1182 /// superclasses. |
1183 void forEachClassMember( | 1183 void forEachClassMember( |
1184 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)); | 1184 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)); |
1185 | 1185 |
1186 /// Returns the declared superclass of [cls]. | 1186 /// Returns the superclass of [cls]. |
1187 /// | 1187 /// |
1188 /// Unnamed mixin applications are included, for instance for these classes | 1188 /// Unnamed mixin applications are included, for instance for these classes |
1189 /// | 1189 /// |
1190 /// class S {} | 1190 /// class S {} |
1191 /// class M {} | 1191 /// class M {} |
1192 /// class C extends S with M {} | 1192 /// class C extends S with M {} |
1193 /// | 1193 /// |
1194 /// the result of `getSuperClass(C)` is the unnamed mixin application | 1194 /// the result of `getSuperClass(C)` is the unnamed mixin application |
1195 /// typically named `S+M` and `getSuperClass(S+M)` is `S`. | 1195 /// typically named `S+M` and `getSuperClass(S+M)` is `S`. |
1196 ClassEntity getSuperClass(ClassEntity cls); | 1196 ClassEntity getSuperClass(ClassEntity cls); |
(...skipping 14 matching lines...) Expand all Loading... |
1211 DartType get dynamicType; | 1211 DartType get dynamicType; |
1212 | 1212 |
1213 /// Returns the 'raw type' of [cls]. That is, the instantiation of [cls] | 1213 /// Returns the 'raw type' of [cls]. That is, the instantiation of [cls] |
1214 /// where all types arguments are `dynamic`. | 1214 /// where all types arguments are `dynamic`. |
1215 InterfaceType getRawType(ClassEntity cls); | 1215 InterfaceType getRawType(ClassEntity cls); |
1216 | 1216 |
1217 /// Returns the 'this type' of [cls]. That is, the instantiation of [cls] | 1217 /// Returns the 'this type' of [cls]. That is, the instantiation of [cls] |
1218 /// where the type arguments are the type variables of [cls]. | 1218 /// where the type arguments are the type variables of [cls]. |
1219 InterfaceType getThisType(ClassEntity cls); | 1219 InterfaceType getThisType(ClassEntity cls); |
1220 | 1220 |
| 1221 /// Returns `true` if [cls] is generic. |
| 1222 bool isGenericClass(ClassEntity cls); |
| 1223 |
1221 /// The upper bound on the [typeVariable]. If not explicitly declared, this is | 1224 /// The upper bound on the [typeVariable]. If not explicitly declared, this is |
1222 /// `Object`. | 1225 /// `Object`. |
1223 DartType getTypeVariableBound(TypeVariableEntity typeVariable); | 1226 DartType getTypeVariableBound(TypeVariableEntity typeVariable); |
1224 | 1227 |
1225 /// Returns `true` if [a] is a subtype of [b]. | 1228 /// Returns `true` if [a] is a subtype of [b]. |
1226 bool isSubtype(DartType a, DartType b); | 1229 bool isSubtype(DartType a, DartType b); |
1227 | 1230 |
1228 /// Returns the type if [function]. | 1231 /// Returns the type if [function]. |
1229 FunctionType getFunctionType(FunctionEntity function); | 1232 FunctionType getFunctionType(FunctionEntity function); |
1230 | 1233 |
1231 /// Returns the type of the [local] function. | 1234 /// Returns the type of the [local] function. |
1232 FunctionType getLocalFunctionType(Local local); | 1235 FunctionType getLocalFunctionType(Local local); |
1233 | 1236 |
1234 /// Returns the unaliased type of [type]. | 1237 /// Returns the unaliased type of [type]. |
1235 /// | 1238 /// |
1236 /// Use this during resolution to ensure that the alias has been computed. | 1239 /// Use this during resolution to ensure that the alias has been computed. |
1237 // TODO(johnniwinther): Remove this when the resolver is removed. | 1240 // TODO(johnniwinther): Remove this when the resolver is removed. |
1238 DartType getUnaliasedType(DartType type); | 1241 DartType getUnaliasedType(DartType type); |
1239 | 1242 |
1240 /// Returns the [CallStructure] corresponding to calling [entity] with all | 1243 /// Returns the [CallStructure] corresponding to calling [entity] with all |
1241 /// arguments, both required and optional. | 1244 /// arguments, both required and optional. |
1242 CallStructure getCallStructure(FunctionEntity entity); | 1245 CallStructure getCallStructure(FunctionEntity entity); |
1243 | 1246 |
1244 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected | 1247 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected |
1245 /// on deferred libraries. | 1248 /// on deferred libraries. |
1246 bool isDeferredLoadLibraryGetter(MemberEntity member); | 1249 bool isDeferredLoadLibraryGetter(MemberEntity member); |
1247 } | 1250 } |
OLD | NEW |