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 26 matching lines...) Expand all Loading... |
37 import '../serialization/serialization.dart' | 37 import '../serialization/serialization.dart' |
38 show DeserializerPlugin, SerializerPlugin; | 38 show DeserializerPlugin, SerializerPlugin; |
39 import '../tree/tree.dart' show Node, Send; | 39 import '../tree/tree.dart' show Node, Send; |
40 import '../universe/call_structure.dart' show CallStructure; | 40 import '../universe/call_structure.dart' show CallStructure; |
41 import '../universe/world_impact.dart' show ImpactStrategy, WorldImpact; | 41 import '../universe/world_impact.dart' show ImpactStrategy, WorldImpact; |
42 import 'codegen.dart' show CodegenWorkItem; | 42 import 'codegen.dart' show CodegenWorkItem; |
43 import 'registry.dart' show Registry; | 43 import 'registry.dart' show Registry; |
44 import 'tasks.dart' show CompilerTask; | 44 import 'tasks.dart' show CompilerTask; |
45 import 'work.dart' show ItemCompilationContext; | 45 import 'work.dart' show ItemCompilationContext; |
46 | 46 |
47 abstract class Backend implements Target { | 47 abstract class Backend extends Target { |
48 final Compiler compiler; | 48 final Compiler compiler; |
49 | 49 |
50 Backend(this.compiler); | 50 Backend(this.compiler); |
51 | 51 |
52 /// Returns true if the backend supports reflection. | 52 /// Returns true if the backend supports reflection. |
53 bool get supportsReflection; | 53 bool get supportsReflection; |
54 | 54 |
55 /// Returns true if the backend supports reflection. | 55 /// Returns true if the backend supports reflection. |
56 bool get supportsAsyncAwait; | 56 bool get supportsAsyncAwait; |
57 | 57 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 bool supportSerialization: true}) { | 397 bool supportSerialization: true}) { |
398 return const ImpactStrategy(); | 398 return const ImpactStrategy(); |
399 } | 399 } |
400 | 400 |
401 /// Backend access to the front-end. | 401 /// Backend access to the front-end. |
402 Frontend get frontend => compiler.resolution; | 402 Frontend get frontend => compiler.resolution; |
403 | 403 |
404 EnqueueTask makeEnqueuer() => new EnqueueTask(compiler); | 404 EnqueueTask makeEnqueuer() => new EnqueueTask(compiler); |
405 } | 405 } |
406 | 406 |
| 407 /// Interface for resolving native data for a target specific element. |
| 408 abstract class NativeRegistry { |
| 409 /// Registers [nativeData] as part of the resolution impact. |
| 410 void registerNativeData(dynamic nativeData); |
| 411 } |
| 412 |
407 /// Interface for resolving calls to foreign functions. | 413 /// Interface for resolving calls to foreign functions. |
408 abstract class ForeignResolver { | 414 abstract class ForeignResolver { |
409 /// Returns the constant expression of [node], or `null` if [node] is not | 415 /// Returns the constant expression of [node], or `null` if [node] is not |
410 /// a constant expression. | 416 /// a constant expression. |
411 ConstantExpression getConstant(Node node); | 417 ConstantExpression getConstant(Node node); |
412 | 418 |
413 /// Registers [type] as instantiated. | 419 /// Registers [type] as instantiated. |
414 void registerInstantiatedType(InterfaceType type); | 420 void registerInstantiatedType(InterfaceType type); |
415 | 421 |
416 /// Resolves [typeName] to a type in the context of [node]. | 422 /// Resolves [typeName] to a type in the context of [node]. |
(...skipping 15 matching lines...) Expand all Loading... |
432 } | 438 } |
433 } | 439 } |
434 | 440 |
435 /// Interface for serialization of backend specific data. | 441 /// Interface for serialization of backend specific data. |
436 class BackendSerialization { | 442 class BackendSerialization { |
437 const BackendSerialization(); | 443 const BackendSerialization(); |
438 | 444 |
439 SerializerPlugin get serializer => const SerializerPlugin(); | 445 SerializerPlugin get serializer => const SerializerPlugin(); |
440 DeserializerPlugin get deserializer => const DeserializerPlugin(); | 446 DeserializerPlugin get deserializer => const DeserializerPlugin(); |
441 } | 447 } |
OLD | NEW |