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 library dart2js.type_system; | 6 library dart2js.type_system; |
6 | 7 |
7 import 'dart_types.dart'; | 8 import 'dart_types.dart'; |
8 import 'elements/elements.dart' show ClassElement; | 9 import 'elements/elements.dart' |
| 10 show |
| 11 ClassElement, |
| 12 ConstructorElement, |
| 13 FunctionElement, |
| 14 LibraryElement, |
| 15 Element; |
9 | 16 |
10 /// The core classes in Dart. | 17 /// The core classes in Dart. |
11 abstract class CoreClasses { | 18 abstract class CoreClasses { |
12 /// The `Object` class defined in 'dart:core'. | 19 /// The `Object` class defined in 'dart:core'. |
13 ClassElement get objectClass; | 20 ClassElement get objectClass; |
14 | 21 |
15 /// The `bool` class defined in 'dart:core'. | 22 /// The `bool` class defined in 'dart:core'. |
16 ClassElement get boolClass; | 23 ClassElement get boolClass; |
17 | 24 |
18 /// The `num` class defined in 'dart:core'. | 25 /// The `num` class defined in 'dart:core'. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 /// The `Iterable` class defined in 'dart:core'; | 61 /// The `Iterable` class defined in 'dart:core'; |
55 ClassElement get iterableClass; | 62 ClassElement get iterableClass; |
56 | 63 |
57 /// The `Future` class defined in 'async'; | 64 /// The `Future` class defined in 'async'; |
58 ClassElement get futureClass; | 65 ClassElement get futureClass; |
59 | 66 |
60 /// The `Stream` class defined in 'async'; | 67 /// The `Stream` class defined in 'async'; |
61 ClassElement get streamClass; | 68 ClassElement get streamClass; |
62 } | 69 } |
63 | 70 |
| 71 /// TODO(sigmund): delete CoreClasses and merge it here. |
| 72 abstract class CommonElements extends CoreClasses { |
| 73 /// The dart:core library. |
| 74 LibraryElement get coreLibrary; |
| 75 |
| 76 /// The dart:async library. |
| 77 LibraryElement get asyncLibrary; |
| 78 |
| 79 /// The dart:mirrors library. Null if the program doesn't access dart:mirrors. |
| 80 LibraryElement get mirrorsLibrary; |
| 81 |
| 82 /// The dart:typed_data library. |
| 83 LibraryElement get typedDataLibrary; |
| 84 |
| 85 /// The `NativeTypedData` class from dart:typed_data. |
| 86 ClassElement get typedDataClass; |
| 87 |
| 88 // TODO(johnniwinther): Move this to the JavaScriptBackend. |
| 89 /// The class for patch annotation defined in dart:_js_helper. |
| 90 ClassElement get patchAnnotationClass; |
| 91 |
| 92 // TODO(johnniwinther): Move this to the JavaScriptBackend. |
| 93 ClassElement get nativeAnnotationClass; |
| 94 |
| 95 /// Constructor of the `Symbol` class. This getter will ensure that `Symbol` |
| 96 /// is resolved and lookup the constructor on demand. |
| 97 ConstructorElement get symbolConstructor; |
| 98 |
| 99 /// Whether [element] is the same as [symbolConstructor]. Used to check |
| 100 /// for the constructor without computing it until it is likely to be seen. |
| 101 bool isSymbolConstructor(Element e); |
| 102 |
| 103 /// The `MirrorSystem` class in dart:mirrors. |
| 104 ClassElement get mirrorSystemClass; |
| 105 |
| 106 /// Whether [element] is `MirrorClass.getName`. Used to check for the use of |
| 107 /// that static method without forcing the resolution of the `MirrorSystem` |
| 108 /// class until it is necessary. |
| 109 bool isMirrorSystemGetNameFunction(Element element); |
| 110 |
| 111 /// The `MirrorsUsed` annotation in dart:mirrors. |
| 112 ClassElement get mirrorsUsedClass; |
| 113 |
| 114 /// Whether [element] is the constructor of the `MirrorsUsed` class. Used to |
| 115 /// check for the constructor without forcing the resolution of the |
| 116 /// `MirrorsUsed` class until it is necessary. |
| 117 bool isMirrorsUsedConstructor(ConstructorElement element); |
| 118 |
| 119 /// The `DeferredLibrary` annotation in dart:async that was used before the |
| 120 /// deferred import syntax was introduced. |
| 121 // TODO(sigmund): drop support for this old syntax? |
| 122 ClassElement get deferredLibraryClass; |
| 123 |
| 124 /// The function `identical` in dart:core. |
| 125 FunctionElement get identicalFunction; |
| 126 |
| 127 /// The method `Function.apply`. |
| 128 FunctionElement get functionApplyMethod; |
| 129 |
| 130 /// Whether [element] is the same as [functionApplyMethod]. This will not |
| 131 /// resolve the apply method if it hasn't been seen yet during compilation. |
| 132 bool isFunctionApplyMethod(Element element); |
| 133 } |
| 134 |
64 /// The core types in Dart. | 135 /// The core types in Dart. |
65 abstract class CoreTypes { | 136 abstract class CoreTypes { |
66 /// The `Object` type defined in 'dart:core'. | 137 /// The `Object` type defined in 'dart:core'. |
67 InterfaceType get objectType; | 138 InterfaceType get objectType; |
68 | 139 |
69 /// The `bool` type defined in 'dart:core'. | 140 /// The `bool` type defined in 'dart:core'. |
70 InterfaceType get boolType; | 141 InterfaceType get boolType; |
71 | 142 |
72 /// The `num` type defined in 'dart:core'. | 143 /// The `num` type defined in 'dart:core'. |
73 InterfaceType get numType; | 144 InterfaceType get numType; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 /// | 196 /// |
126 /// If no type argument is provided, the canonical raw type is returned. | 197 /// If no type argument is provided, the canonical raw type is returned. |
127 InterfaceType futureType([DartType elementType]); | 198 InterfaceType futureType([DartType elementType]); |
128 | 199 |
129 /// Returns an instance of the `Stream` type defined in 'dart:async' with | 200 /// Returns an instance of the `Stream` type defined in 'dart:async' with |
130 /// [elementType] as its type argument. | 201 /// [elementType] as its type argument. |
131 /// | 202 /// |
132 /// If no type argument is provided, the canonical raw type is returned. | 203 /// If no type argument is provided, the canonical raw type is returned. |
133 InterfaceType streamType([DartType elementType]); | 204 InterfaceType streamType([DartType elementType]); |
134 } | 205 } |
OLD | NEW |