| 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; |
| 11 import '../common/resolution.dart' show ResolutionImpact, Frontend; | 11 import '../common/resolution.dart' show ResolutionImpact, Frontend, Target; |
| 12 import '../compile_time_constants.dart' | 12 import '../compile_time_constants.dart' |
| 13 show BackendConstantEnvironment, ConstantCompilerTask; | 13 show BackendConstantEnvironment, ConstantCompilerTask; |
| 14 import '../compiler.dart' show Compiler; | 14 import '../compiler.dart' show Compiler; |
| 15 import '../constants/constant_system.dart' show ConstantSystem; | 15 import '../constants/constant_system.dart' show ConstantSystem; |
| 16 import '../constants/expressions.dart' show ConstantExpression; | 16 import '../constants/expressions.dart' show ConstantExpression; |
| 17 import '../constants/values.dart' show ConstantValue; | 17 import '../constants/values.dart' show ConstantValue; |
| 18 import '../dart_types.dart' show DartType, InterfaceType; | 18 import '../dart_types.dart' show DartType, InterfaceType; |
| 19 import '../elements/elements.dart' | 19 import '../elements/elements.dart' |
| 20 show | 20 show |
| 21 ClassElement, | 21 ClassElement, |
| (...skipping 15 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 { | 47 abstract class Backend implements 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 /// Returns `true` if the `native` pseudo keyword is supported for [library]. | 249 /// Returns `true` if the `native` pseudo keyword is supported for [library]. |
| 250 bool canLibraryUseNative(LibraryElement library) { | 250 bool canLibraryUseNative(LibraryElement library) { |
| 251 // TODO(johnniwinther): Move this to [JavaScriptBackend]. | 251 // TODO(johnniwinther): Move this to [JavaScriptBackend]. |
| 252 return native.maybeEnableNative(compiler, library); | 252 return native.maybeEnableNative(compiler, library); |
| 253 } | 253 } |
| 254 | 254 |
| 255 /// Processes [element] for resolution and returns the [MethodElement] that | 255 /// Processes [element] for resolution and returns the [MethodElement] that |
| 256 /// defines the implementation of [element]. | 256 /// defines the implementation of [element]. |
| 257 MethodElement resolveExternalFunction(MethodElement element) => element; | 257 MethodElement resolveExternalFunction(MethodElement element) => element; |
| 258 | 258 |
| 259 /// Returns `true` if [library] is a backend specific library whose members | 259 @override |
| 260 /// have special treatment, such as being allowed to extends blacklisted | 260 bool isTargetSpecificLibrary(LibraryElement library) { |
| 261 /// classes or member being eagerly resolved. | |
| 262 bool isBackendLibrary(LibraryElement library) { | |
| 263 // TODO(johnniwinther): Remove this when patching is only done by the | 261 // TODO(johnniwinther): Remove this when patching is only done by the |
| 264 // JavaScript backend. | 262 // JavaScript backend. |
| 265 Uri canonicalUri = library.canonicalUri; | 263 Uri canonicalUri = library.canonicalUri; |
| 266 if (canonicalUri == js_backend.BackendHelpers.DART_JS_HELPER || | 264 if (canonicalUri == js_backend.BackendHelpers.DART_JS_HELPER || |
| 267 canonicalUri == js_backend.BackendHelpers.DART_INTERCEPTORS) { | 265 canonicalUri == js_backend.BackendHelpers.DART_INTERCEPTORS) { |
| 268 return true; | 266 return true; |
| 269 } | 267 } |
| 270 return false; | 268 return false; |
| 271 } | 269 } |
| 272 | 270 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 432 } |
| 435 } | 433 } |
| 436 | 434 |
| 437 /// Interface for serialization of backend specific data. | 435 /// Interface for serialization of backend specific data. |
| 438 class BackendSerialization { | 436 class BackendSerialization { |
| 439 const BackendSerialization(); | 437 const BackendSerialization(); |
| 440 | 438 |
| 441 SerializerPlugin get serializer => const SerializerPlugin(); | 439 SerializerPlugin get serializer => const SerializerPlugin(); |
| 442 DeserializerPlugin get deserializer => const DeserializerPlugin(); | 440 DeserializerPlugin get deserializer => const DeserializerPlugin(); |
| 443 } | 441 } |
| OLD | NEW |