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 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/codegen.dart' show CodegenImpact; | 10 import '../common/codegen.dart' show CodegenImpact; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ConstantCompilerTask get constantCompilerTask; | 57 ConstantCompilerTask get constantCompilerTask; |
58 | 58 |
59 /// Backend transformation methods for the world impacts. | 59 /// Backend transformation methods for the world impacts. |
60 ImpactTransformer get impactTransformer; | 60 ImpactTransformer get impactTransformer; |
61 | 61 |
62 /// The strategy used for collecting and emitting source information. | 62 /// The strategy used for collecting and emitting source information. |
63 SourceInformationStrategy get sourceInformationStrategy { | 63 SourceInformationStrategy get sourceInformationStrategy { |
64 return const SourceInformationStrategy(); | 64 return const SourceInformationStrategy(); |
65 } | 65 } |
66 | 66 |
| 67 /// Common classes used by the backend. |
| 68 BackendClasses get backendClasses; |
| 69 |
67 /// Interface for serialization of backend specific data. | 70 /// Interface for serialization of backend specific data. |
68 BackendSerialization get serialization => const BackendSerialization(); | 71 BackendSerialization get serialization => const BackendSerialization(); |
69 | 72 |
70 // TODO(johnniwinther): Move this to the JavaScriptBackend. | 73 // TODO(johnniwinther): Move this to the JavaScriptBackend. |
71 String get patchVersion => null; | 74 String get patchVersion => null; |
72 | 75 |
73 /// Set of classes that need to be considered for reflection although not | 76 /// Set of classes that need to be considered for reflection although not |
74 /// otherwise visible during resolution. | 77 /// otherwise visible during resolution. |
75 Iterable<ClassElement> classesRequiredForReflection = const []; | 78 Iterable<ClassElement> classesRequiredForReflection = const []; |
76 | 79 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void enableNoSuchMethod(Enqueuer enqueuer) {} | 178 void enableNoSuchMethod(Enqueuer enqueuer) {} |
176 | 179 |
177 /// Returns whether or not `noSuchMethod` support has been enabled. | 180 /// Returns whether or not `noSuchMethod` support has been enabled. |
178 bool get enabledNoSuchMethod => false; | 181 bool get enabledNoSuchMethod => false; |
179 | 182 |
180 /// Call this method to enable support for isolates. | 183 /// Call this method to enable support for isolates. |
181 void enableIsolateSupport(Enqueuer enqueuer) {} | 184 void enableIsolateSupport(Enqueuer enqueuer) {} |
182 | 185 |
183 void registerConstSymbol(String name) {} | 186 void registerConstSymbol(String name) {} |
184 | 187 |
185 bool isNullImplementation(ClassElement cls) { | |
186 return cls == compiler.coreClasses.nullClass; | |
187 } | |
188 | |
189 ClassElement get intImplementation => compiler.coreClasses.intClass; | |
190 ClassElement get doubleImplementation => compiler.coreClasses.doubleClass; | |
191 ClassElement get numImplementation => compiler.coreClasses.numClass; | |
192 ClassElement get stringImplementation => compiler.coreClasses.stringClass; | |
193 ClassElement get listImplementation => compiler.coreClasses.listClass; | |
194 ClassElement get growableListImplementation => compiler.coreClasses.listClass; | |
195 ClassElement get fixedListImplementation => compiler.coreClasses.listClass; | |
196 ClassElement get constListImplementation => compiler.coreClasses.listClass; | |
197 ClassElement get mapImplementation => compiler.coreClasses.mapClass; | |
198 ClassElement get constMapImplementation => compiler.coreClasses.mapClass; | |
199 ClassElement get functionImplementation => compiler.coreClasses.functionClass; | |
200 ClassElement get typeImplementation => compiler.coreClasses.typeClass; | |
201 ClassElement get boolImplementation => compiler.coreClasses.boolClass; | |
202 ClassElement get nullImplementation => compiler.coreClasses.nullClass; | |
203 ClassElement get uint32Implementation => compiler.coreClasses.intClass; | |
204 ClassElement get uint31Implementation => compiler.coreClasses.intClass; | |
205 ClassElement get positiveIntImplementation => compiler.coreClasses.intClass; | |
206 ClassElement get syncStarIterableImplementation => | |
207 compiler.coreClasses.iterableClass; | |
208 ClassElement get asyncFutureImplementation => | |
209 compiler.coreClasses.futureClass; | |
210 ClassElement get asyncStarStreamImplementation => | |
211 compiler.coreClasses.streamClass; | |
212 | |
213 ClassElement defaultSuperclass(ClassElement element) { | 188 ClassElement defaultSuperclass(ClassElement element) { |
214 return compiler.coreClasses.objectClass; | 189 return compiler.coreClasses.objectClass; |
215 } | 190 } |
216 | 191 |
217 bool isInterceptorClass(ClassElement element) => false; | 192 bool isInterceptorClass(ClassElement element) => false; |
218 | 193 |
219 /// Returns `true` if [element] is implemented via typed JavaScript interop. | 194 /// Returns `true` if [element] is implemented via typed JavaScript interop. |
220 // TODO(johnniwinther): Move this to [JavaScriptBackend]. | 195 // TODO(johnniwinther): Move this to [JavaScriptBackend]. |
221 bool isJsInterop(Element element) => false; | 196 bool isJsInterop(Element element) => false; |
222 | 197 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 379 } |
405 } | 380 } |
406 | 381 |
407 /// Interface for serialization of backend specific data. | 382 /// Interface for serialization of backend specific data. |
408 class BackendSerialization { | 383 class BackendSerialization { |
409 const BackendSerialization(); | 384 const BackendSerialization(); |
410 | 385 |
411 SerializerPlugin get serializer => const SerializerPlugin(); | 386 SerializerPlugin get serializer => const SerializerPlugin(); |
412 DeserializerPlugin get deserializer => const DeserializerPlugin(); | 387 DeserializerPlugin get deserializer => const DeserializerPlugin(); |
413 } | 388 } |
| 389 |
| 390 /// Interface providing access to core classes used by the backend. |
| 391 abstract class BackendClasses { |
| 392 ClassElement get intImplementation; |
| 393 ClassElement get doubleImplementation; |
| 394 ClassElement get numImplementation; |
| 395 ClassElement get stringImplementation; |
| 396 ClassElement get listImplementation; |
| 397 ClassElement get growableListImplementation; |
| 398 ClassElement get fixedListImplementation; |
| 399 ClassElement get constListImplementation; |
| 400 ClassElement get mapImplementation; |
| 401 ClassElement get constMapImplementation; |
| 402 ClassElement get functionImplementation; |
| 403 ClassElement get typeImplementation; |
| 404 ClassElement get boolImplementation; |
| 405 ClassElement get nullImplementation; |
| 406 ClassElement get uint32Implementation; |
| 407 ClassElement get uint31Implementation; |
| 408 ClassElement get positiveIntImplementation; |
| 409 ClassElement get syncStarIterableImplementation; |
| 410 ClassElement get asyncFutureImplementation; |
| 411 ClassElement get asyncStarStreamImplementation; |
| 412 } |
OLD | NEW |