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 Uris; | 8 import 'common/names.dart' show Uris; |
9 import 'elements/types.dart'; | 9 import 'elements/types.dart'; |
10 import 'elements/entities.dart'; | 10 import 'elements/entities.dart'; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 /// Calls [f] for each class member declared or inherited in [cls] together | 245 /// Calls [f] for each class member declared or inherited in [cls] together |
246 /// with the class that declared the member. | 246 /// with the class that declared the member. |
247 /// | 247 /// |
248 /// TODO(johnniwinther): This should not include static members of | 248 /// TODO(johnniwinther): This should not include static members of |
249 /// superclasses. | 249 /// superclasses. |
250 void forEachClassMember( | 250 void forEachClassMember( |
251 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)); | 251 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)); |
252 | 252 |
253 /// Returns the declared superclass of [cls]. | 253 /// Returns the declared superclass of [cls]. |
254 /// | 254 /// |
255 /// Unnamed mixin applications are skipped, for instance for these classes | 255 /// Unnamed mixin applications are included, for instance for these classes |
256 /// | 256 /// |
257 /// class S {} | 257 /// class S {} |
258 /// class M {} | 258 /// class M {} |
259 /// class C extends S with M {} | 259 /// class C extends S with M {} |
260 /// | 260 /// |
261 /// the result of `getSuperClass(C)` is `S` and not the unnamed mixin | 261 /// the result of `getSuperClass(C)` is the unnamed mixin application |
262 /// application typically named `S+M`. | 262 /// typically named `S+M` and `getSuperClass(S+M)` is `S`. |
263 ClassEntity getSuperClass(ClassEntity cls); | 263 ClassEntity getSuperClass(ClassEntity cls); |
264 | 264 |
| 265 void forEachSupertype(ClassEntity cls, void f(InterfaceType supertype)); |
| 266 |
265 /// Calls [f] for each class that is mixed into [cls] or one of its | 267 /// Calls [f] for each class that is mixed into [cls] or one of its |
266 /// superclasses. | 268 /// superclasses. |
267 void forEachMixin(ClassEntity cls, void f(ClassEntity mixin)); | 269 void forEachMixin(ClassEntity cls, void f(ClassEntity mixin)); |
268 | 270 |
269 /// Create the instantiation of [cls] with the given [typeArguments]. | 271 /// Create the instantiation of [cls] with the given [typeArguments]. |
270 InterfaceType createInterfaceType( | 272 InterfaceType createInterfaceType( |
271 ClassEntity cls, List<DartType> typeArguments); | 273 ClassEntity cls, List<DartType> typeArguments); |
272 | 274 |
273 /// Returns the `dynamic` type. | 275 /// Returns the `dynamic` type. |
274 // TODO(johnniwinther): Remove this when `ResolutionDynamicType` is no longer | 276 // TODO(johnniwinther): Remove this when `ResolutionDynamicType` is no longer |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 } | 568 } |
567 | 569 |
568 @override | 570 @override |
569 InterfaceType streamType([DartType elementType]) { | 571 InterfaceType streamType([DartType elementType]) { |
570 if (elementType == null) { | 572 if (elementType == null) { |
571 return getRawType(streamClass); | 573 return getRawType(streamClass); |
572 } | 574 } |
573 return createInterfaceType(streamClass, [elementType]); | 575 return createInterfaceType(streamClass, [elementType]); |
574 } | 576 } |
575 } | 577 } |
OLD | NEW |