| 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 12 matching lines...) Expand all Loading... |
| 23 import '../io/source_information.dart' show SourceInformationStrategy; | 23 import '../io/source_information.dart' show SourceInformationStrategy; |
| 24 import '../js_backend/backend_helpers.dart' as js_backend show BackendHelpers; | 24 import '../js_backend/backend_helpers.dart' as js_backend show BackendHelpers; |
| 25 import '../js_backend/js_backend.dart' as js_backend; | 25 import '../js_backend/js_backend.dart' as js_backend; |
| 26 import '../library_loader.dart' show LibraryLoader, LoadedLibraries; | 26 import '../library_loader.dart' show LibraryLoader, LoadedLibraries; |
| 27 import '../native/native.dart' as native show NativeEnqueuer, maybeEnableNative; | 27 import '../native/native.dart' as native show NativeEnqueuer, maybeEnableNative; |
| 28 import '../patch_parser.dart' | 28 import '../patch_parser.dart' |
| 29 show checkNativeAnnotation, checkJsInteropAnnotation; | 29 show checkNativeAnnotation, checkJsInteropAnnotation; |
| 30 import '../serialization/serialization.dart' | 30 import '../serialization/serialization.dart' |
| 31 show DeserializerPlugin, SerializerPlugin; | 31 show DeserializerPlugin, SerializerPlugin; |
| 32 import '../tree/tree.dart' show Node; | 32 import '../tree/tree.dart' show Node; |
| 33 import '../universe/world_impact.dart' show ImpactStrategy, WorldImpact; | 33 import '../universe/world_impact.dart' |
| 34 show ImpactStrategy, WorldImpact, WorldImpactBuilder; |
| 34 import 'codegen.dart' show CodegenWorkItem; | 35 import 'codegen.dart' show CodegenWorkItem; |
| 35 import 'registry.dart' show Registry; | 36 import 'registry.dart' show Registry; |
| 36 import 'tasks.dart' show CompilerTask; | 37 import 'tasks.dart' show CompilerTask; |
| 37 | 38 |
| 38 abstract class Backend extends Target { | 39 abstract class Backend extends Target { |
| 39 final Compiler compiler; | 40 final Compiler compiler; |
| 40 | 41 |
| 41 Backend(this.compiler); | 42 Backend(this.compiler); |
| 42 | 43 |
| 43 /// Returns true if the backend supports reflection. | 44 /// Returns true if the backend supports reflection. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 110 |
| 110 /// Enable compilation of code with compile time errors. Returns `true` if | 111 /// Enable compilation of code with compile time errors. Returns `true` if |
| 111 /// supported by the backend. | 112 /// supported by the backend. |
| 112 bool enableCodegenWithErrorsIfSupported(Spannable node); | 113 bool enableCodegenWithErrorsIfSupported(Spannable node); |
| 113 | 114 |
| 114 /// Enable deferred loading. Returns `true` if the backend supports deferred | 115 /// Enable deferred loading. Returns `true` if the backend supports deferred |
| 115 /// loading. | 116 /// loading. |
| 116 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry); | 117 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry); |
| 117 | 118 |
| 118 /// Called during codegen when [constant] has been used. | 119 /// Called during codegen when [constant] has been used. |
| 119 void registerCompileTimeConstant(ConstantValue constant, Registry registry) {} | 120 void computeImpactForCompileTimeConstant(ConstantValue constant, |
| 121 WorldImpactBuilder impactBuilder, bool isForResolution) {} |
| 120 | 122 |
| 121 /// Called to notify to the backend that a class is being instantiated. | 123 /// Called to notify to the backend that a class is being instantiated. |
| 122 // TODO(johnniwinther): Remove this. It's only called once for each [cls] and | 124 // TODO(johnniwinther): Remove this. It's only called once for each [cls] and |
| 123 // only with [Compiler.globalDependencies] as [registry]. | 125 // only with [Compiler.globalDependencies] as [registry]. |
| 124 void registerInstantiatedClass( | 126 void registerInstantiatedClass( |
| 125 ClassElement cls, Enqueuer enqueuer, Registry registry) {} | 127 ClassElement cls, Enqueuer enqueuer, Registry registry) {} |
| 126 | 128 |
| 127 /// Called to notify to the backend that a class is implemented by an | 129 /// Called to notify to the backend that a class is implemented by an |
| 128 /// instantiated class. | 130 /// instantiated class. |
| 129 void registerImplementedClass( | 131 void registerImplementedClass( |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 404 } |
| 403 } | 405 } |
| 404 | 406 |
| 405 /// Interface for serialization of backend specific data. | 407 /// Interface for serialization of backend specific data. |
| 406 class BackendSerialization { | 408 class BackendSerialization { |
| 407 const BackendSerialization(); | 409 const BackendSerialization(); |
| 408 | 410 |
| 409 SerializerPlugin get serializer => const SerializerPlugin(); | 411 SerializerPlugin get serializer => const SerializerPlugin(); |
| 410 DeserializerPlugin get deserializer => const DeserializerPlugin(); | 412 DeserializerPlugin get deserializer => const DeserializerPlugin(); |
| 411 } | 413 } |
| OLD | NEW |