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 dart2js.backend_api; | 5 library dart2js.backend_api; |
6 | 6 |
7 import '../common/resolution.dart' show ResolutionImpact; | 7 import '../common/resolution.dart' show ResolutionImpact; |
8 import '../constants/expressions.dart' show ConstantExpression; | 8 import '../constants/expressions.dart' show ConstantExpression; |
9 import '../elements/types.dart'; | 9 import '../elements/types.dart'; |
10 import '../elements/resolution_types.dart' | 10 import '../elements/resolution_types.dart' |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 /// Interface for serialization of backend specific data. | 51 /// Interface for serialization of backend specific data. |
52 class BackendSerialization { | 52 class BackendSerialization { |
53 const BackendSerialization(); | 53 const BackendSerialization(); |
54 | 54 |
55 SerializerPlugin get serializer => const SerializerPlugin(); | 55 SerializerPlugin get serializer => const SerializerPlugin(); |
56 DeserializerPlugin get deserializer => const DeserializerPlugin(); | 56 DeserializerPlugin get deserializer => const DeserializerPlugin(); |
57 } | 57 } |
58 | |
59 /// Interface providing access to core classes used by the backend. | |
60 abstract class BackendClasses { | |
61 /// Returns the backend implementation class for `int`. This is the `JSInt` | |
62 /// class. | |
63 ClassEntity get intClass; | |
64 | |
65 /// Returns the backend implementation class for `double`. This is the | |
66 /// `JSDouble` class. | |
67 ClassEntity get doubleClass; | |
68 | |
69 /// Returns the backend implementation class for `num`. This is the `JSNum` | |
70 /// class. | |
71 ClassEntity get numClass; | |
72 | |
73 /// Returns the backend implementation class for `String`. This is the | |
74 /// `JSString` class. | |
75 ClassEntity get stringClass; | |
76 | |
77 /// Returns the backend implementation class for `List`. This is the | |
78 /// `JSArray` class. | |
79 ClassEntity get listClass; | |
80 | |
81 /// Returns the backend dummy class used to track mutable implementations of | |
82 /// `List` in type masks. This is the `JSMutableArray` class. | |
83 ClassEntity get mutableListClass; | |
84 | |
85 /// Returns the backend dummy class used to track growable implementations of | |
86 /// `List` in type masks. This is the `JSExtendableArray` class. | |
87 ClassEntity get growableListClass; | |
88 | |
89 /// Returns the backend dummy class used to track fixed-sized implementations | |
90 /// of `List` in type masks. This is the `JSFixedArray` class. | |
91 ClassEntity get fixedListClass; | |
92 | |
93 /// Returns the backend dummy class used to track unmodifiable (constant) | |
94 /// implementations of `List` in type masks. This is the `JSUnmodifiableArray` | |
95 /// class. | |
96 ClassEntity get constListClass; | |
97 | |
98 /// Returns the backend implementation class for map literals. This is the | |
99 /// `LinkedHashMap` class. | |
100 ClassEntity get mapClass; | |
101 | |
102 /// Returns the backend superclass for implementations of constant map | |
103 /// literals. This is the `ConstantMap` class. | |
104 ClassEntity get constMapClass; | |
105 | |
106 /// Returns the backend implementation class for `Function`. This is the | |
107 /// `Function` class from 'dart:core'. | |
108 ClassEntity get functionClass; | |
109 | |
110 /// Returns the backend implementation class for `Type`. This is the | |
111 /// `TypeImpl` class. | |
112 ClassEntity get typeClass; | |
113 | |
114 /// Returns the type of the implementation class for `Type`. | |
115 InterfaceType get typeType; | |
116 | |
117 /// Returns the backend implementation class for `bool`. This is the `JSBool` | |
118 /// class. | |
119 ClassEntity get boolClass; | |
120 | |
121 /// Returns the backend implementation class for `null`. This is the `JSNull` | |
122 /// class. | |
123 ClassEntity get nullClass; | |
124 | |
125 /// Returns the backend dummy class used to track unsigned 32-bit integer | |
126 /// values in type masks. This is the `JSUint32` class. | |
127 ClassEntity get uint32Class; | |
128 | |
129 /// Returns the backend dummy class used to track unsigned 31-bit integer | |
130 /// values in type masks. This is the `JSUint31` class. | |
131 ClassEntity get uint31Class; | |
132 | |
133 /// Returns the backend dummy class used to track position values in type | |
134 /// masks. This is the `JSPositiveInt` class. | |
135 ClassEntity get positiveIntClass; | |
136 | |
137 /// Returns the backend implementation class for the `Iterable` used in | |
138 /// `sync*` methods. This is the `_SyncStarIterable` class in dart:async. | |
139 ClassEntity get syncStarIterableClass; | |
140 | |
141 /// Returns the backend implementation class for the `Future` used in | |
142 /// `async` methods. This is the `_Future` class in dart:async. | |
143 ClassEntity get asyncFutureClass; | |
144 | |
145 /// Returns the backend implementation class for the `Stream` used in | |
146 /// `async*` methods. This is the `_ControllerStream` class in dart:async. | |
147 ClassEntity get asyncStarStreamClass; | |
148 | |
149 /// Returns the backend superclass directly indexable class, that is classes | |
150 /// that natively support the `[]` operator. This is the `JSIndexable` class. | |
151 ClassEntity get indexableClass; | |
152 | |
153 /// Returns the backend superclass directly indexable class, that is classes | |
154 /// that natively support the `[]=` operator. This is the `JSMutableIndexable` | |
155 /// class. | |
156 ClassEntity get mutableIndexableClass; | |
157 | |
158 /// Returns the backend class used to mark native classes that support integer | |
159 /// indexing, that is `[]` and `[]=` where the key is an integer. This is the | |
160 /// `JavaScriptIndexingBehavior` class. | |
161 ClassEntity get indexingBehaviorClass; | |
162 | |
163 /// Returns the backend superclass for all intercepted classes. This is the | |
164 /// `Interceptor` class. | |
165 ClassEntity get interceptorClass; | |
166 | |
167 /// Returns `true` if [element] is a default implementation of `Object.==`. | |
168 /// This either `Object.==`, `Intercepter.==` or `Null.==`. | |
169 bool isDefaultEqualityImplementation(MemberEntity element); | |
170 | |
171 /// Returns `true` if [cls] is a native class. | |
172 bool isNativeClass(ClassEntity element); | |
173 | |
174 /// Returns the type of the constant map implementation for a const map | |
175 /// literal of [sourceType]. If [hasProtoKey] the map contains key of value | |
176 /// '__proto__' and if [onlyStringKeys] all keys are string constants. | |
177 InterfaceType getConstantMapTypeFor(InterfaceType sourceType, | |
178 {bool hasProtoKey: false, bool onlyStringKeys: false}); | |
179 | |
180 /// Returns the type of the constant symbol implementation class. | |
181 InterfaceType get symbolType; | |
182 | |
183 /// Returns the field of the constant symbol implementation class that holds | |
184 /// its internal name. | |
185 FieldEntity get symbolField; | |
186 } | |
OLD | NEW |