| 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 | 10 import '../common/codegen.dart' show |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 import '../patch_parser.dart' show | 53 import '../patch_parser.dart' show |
| 54 checkNativeAnnotation, checkJsInteropAnnotation; | 54 checkNativeAnnotation, checkJsInteropAnnotation; |
| 55 import '../resolution/tree_elements.dart' show | 55 import '../resolution/tree_elements.dart' show |
| 56 TreeElements; | 56 TreeElements; |
| 57 import '../tree/tree.dart' show | 57 import '../tree/tree.dart' show |
| 58 Node, | 58 Node, |
| 59 Send; | 59 Send; |
| 60 import '../universe/call_structure.dart' show | 60 import '../universe/call_structure.dart' show |
| 61 CallStructure; | 61 CallStructure; |
| 62 import '../universe/world_impact.dart' show | 62 import '../universe/world_impact.dart' show |
| 63 ImpactStrategy, | |
| 64 WorldImpact; | 63 WorldImpact; |
| 65 | 64 |
| 66 import 'codegen.dart' show | 65 import 'codegen.dart' show |
| 67 CodegenWorkItem; | 66 CodegenWorkItem; |
| 68 import 'registry.dart' show | 67 import 'registry.dart' show |
| 69 Registry; | 68 Registry; |
| 70 import 'tasks.dart' show | 69 import 'tasks.dart' show |
| 71 CompilerTask; | 70 CompilerTask; |
| 72 import 'work.dart' show | 71 import 'work.dart' show |
| 73 ItemCompilationContext; | 72 ItemCompilationContext; |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 void registerForeignCall(Send node, | 417 void registerForeignCall(Send node, |
| 419 Element element, | 418 Element element, |
| 420 CallStructure callStructure, | 419 CallStructure callStructure, |
| 421 ForeignResolver resolver) {} | 420 ForeignResolver resolver) {} |
| 422 | 421 |
| 423 /// Returns the location of the patch-file associated with [libraryName] | 422 /// Returns the location of the patch-file associated with [libraryName] |
| 424 /// resolved from [plaformConfigUri]. | 423 /// resolved from [plaformConfigUri]. |
| 425 /// | 424 /// |
| 426 /// Returns null if there is none. | 425 /// Returns null if there is none. |
| 427 Uri resolvePatchUri(String libraryName, Uri plaformConfigUri); | 426 Uri resolvePatchUri(String libraryName, Uri plaformConfigUri); |
| 428 | |
| 429 /// Creates an impact strategy to use for compilation. | |
| 430 ImpactStrategy createImpactStrategy( | |
| 431 {bool supportDeferredLoad: true, | |
| 432 bool supportDumpInfo: true}) { | |
| 433 return const ImpactStrategy(); | |
| 434 } | |
| 435 } | 427 } |
| 436 | 428 |
| 437 /// Interface for resolving calls to foreign functions. | 429 /// Interface for resolving calls to foreign functions. |
| 438 abstract class ForeignResolver { | 430 abstract class ForeignResolver { |
| 439 /// Returns the constant expression of [node], or `null` if [node] is not | 431 /// Returns the constant expression of [node], or `null` if [node] is not |
| 440 /// a constant expression. | 432 /// a constant expression. |
| 441 ConstantExpression getConstant(Node node); | 433 ConstantExpression getConstant(Node node); |
| 442 | 434 |
| 443 /// Registers [type] as instantiated. | 435 /// Registers [type] as instantiated. |
| 444 void registerInstantiatedType(InterfaceType type); | 436 void registerInstantiatedType(InterfaceType type); |
| 445 | 437 |
| 446 /// Resolves [typeName] to a type in the context of [node]. | 438 /// Resolves [typeName] to a type in the context of [node]. |
| 447 DartType resolveTypeFromString(Node node, String typeName); | 439 DartType resolveTypeFromString(Node node, String typeName); |
| 448 } | 440 } |
| 449 | 441 |
| 450 /// Backend transformation methods for the world impacts. | 442 /// Backend transformation methods for the world impacts. |
| 451 class ImpactTransformer { | 443 class ImpactTransformer { |
| 452 /// Transform the [ResolutionImpact] into a [WorldImpact] adding the | 444 /// Transform the [ResolutionImpact] into a [WorldImpact] adding the |
| 453 /// backend dependencies for features used in [worldImpact]. | 445 /// backend dependencies for features used in [worldImpact]. |
| 454 WorldImpact transformResolutionImpact(ResolutionImpact worldImpact) { | 446 WorldImpact transformResolutionImpact(ResolutionImpact worldImpact) { |
| 455 return worldImpact; | 447 return worldImpact; |
| 456 } | 448 } |
| 457 | 449 |
| 458 /// Transform the [CodegenImpact] into a [WorldImpact] adding the | 450 /// Transform the [CodegenImpact] into a [WorldImpact] adding the |
| 459 /// backend dependencies for features used in [worldImpact]. | 451 /// backend dependencies for features used in [worldImpact]. |
| 460 WorldImpact transformCodegenImpact(CodegenImpact worldImpact) { | 452 WorldImpact transformCodegenImpact(CodegenImpact worldImpact) { |
| 461 return worldImpact; | 453 return worldImpact; |
| 462 } | 454 } |
| 463 } | 455 } |
| OLD | NEW |