| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.frontend_strategy; | 5 library dart2js.frontend_strategy; |
| 6 | 6 |
| 7 import 'common.dart'; | 7 import 'common.dart'; |
| 8 import 'common_elements.dart'; | 8 import 'common_elements.dart'; |
| 9 import 'common/backend_api.dart'; |
| 9 import 'common/tasks.dart'; | 10 import 'common/tasks.dart'; |
| 10 import 'elements/entities.dart'; | 11 import 'elements/entities.dart'; |
| 11 import 'environment.dart'; | 12 import 'environment.dart'; |
| 13 import 'enqueue.dart'; |
| 14 import 'js_backend/backend.dart'; |
| 15 import 'js_backend/backend_usage.dart'; |
| 16 import 'js_backend/custom_elements_analysis.dart'; |
| 17 import 'js_backend/mirrors_analysis.dart'; |
| 18 import 'js_backend/mirrors_data.dart'; |
| 12 import 'js_backend/native_data.dart'; | 19 import 'js_backend/native_data.dart'; |
| 20 import 'js_backend/no_such_method_registry.dart'; |
| 13 import 'library_loader.dart'; | 21 import 'library_loader.dart'; |
| 14 import 'native/resolver.dart'; | 22 import 'native/resolver.dart'; |
| 15 import 'serialization/task.dart'; | 23 import 'serialization/task.dart'; |
| 16 import 'patch_parser.dart'; | 24 import 'patch_parser.dart'; |
| 17 import 'resolved_uri_translator.dart'; | 25 import 'resolved_uri_translator.dart'; |
| 26 import 'universe/world_builder.dart'; |
| 18 | 27 |
| 19 /// Strategy pattern that defines the connection between the input format and | 28 /// Strategy pattern that defines the connection between the input format and |
| 20 /// the resolved element model. | 29 /// the resolved element model. |
| 21 abstract class FrontEndStrategy { | 30 abstract class FrontEndStrategy { |
| 22 /// Creates library loader task for this strategy. | 31 /// Creates library loader task for this strategy. |
| 23 LibraryLoaderTask createLibraryLoader( | 32 LibraryLoaderTask createLibraryLoader( |
| 24 ResolvedUriTranslator uriTranslator, | 33 ResolvedUriTranslator uriTranslator, |
| 25 ScriptLoader scriptLoader, | 34 ScriptLoader scriptLoader, |
| 26 ElementScanner scriptScanner, | 35 ElementScanner scriptScanner, |
| 27 LibraryDeserializer deserializer, | 36 LibraryDeserializer deserializer, |
| 28 PatchResolverFunction patchResolverFunc, | 37 PatchResolverFunction patchResolverFunc, |
| 29 PatchParserTask patchParser, | 38 PatchParserTask patchParser, |
| 30 Environment environment, | 39 Environment environment, |
| 31 DiagnosticReporter reporter, | 40 DiagnosticReporter reporter, |
| 32 Measurer measurer); | 41 Measurer measurer); |
| 33 | 42 |
| 34 /// Returns the [ElementEnvironment] for the element model used in this | 43 /// Returns the [ElementEnvironment] for the element model used in this |
| 35 /// strategy. | 44 /// strategy. |
| 36 ElementEnvironment get elementEnvironment; | 45 ElementEnvironment get elementEnvironment; |
| 37 | 46 |
| 38 /// Returns the [AnnotationProcessor] for this strategy. | 47 /// Returns the [AnnotationProcessor] for this strategy. |
| 39 AnnotationProcessor get annotationProcesser; | 48 AnnotationProcessor get annotationProcesser; |
| 40 | 49 |
| 41 /// Creates the [NativeClassResolver] for this strategy. | 50 /// Creates the [NativeClassResolver] for this strategy. |
| 42 NativeClassResolver createNativeClassResolver( | 51 NativeClassResolver createNativeClassResolver( |
| 43 NativeBasicData nativeBasicData); | 52 NativeBasicData nativeBasicData); |
| 53 |
| 54 /// Creates the [NoSuchMethodResolver] corresponding the resolved model of |
| 55 /// this strategy. |
| 56 NoSuchMethodResolver createNoSuchMethodResolver(); |
| 57 |
| 58 /// Creates the [ResolutionWorldBuilder] corresponding to the element model |
| 59 /// used in this strategy. |
| 60 ResolutionWorldBuilder createResolutionWorldBuilder( |
| 61 NativeBasicData nativeBasicData, |
| 62 SelectorConstraintsStrategy selectorConstraintsStrategy); |
| 63 |
| 64 /// Creates the [WorkItemBuilder] corresponding to how a resolved model for |
| 65 /// a single member is obtained in this strategy. |
| 66 WorkItemBuilder createResolutionWorkItemBuilder( |
| 67 ImpactTransformer impactTransformer); |
| 68 |
| 69 // TODO(johnniwinther): Reuse the following classes between strategies: |
| 70 |
| 71 /// Creates the [CustomElementsResolutionAnalysis] for this strategy. |
| 72 CustomElementsResolutionAnalysis createCustomElementsResolutionAnalysis( |
| 73 NativeBasicData nativeBasicData, BackendUsageBuilder backendUsageBuilder); |
| 74 |
| 75 /// Creates the [MirrorsDataBuilder] for this strategy. |
| 76 MirrorsDataBuilder createMirrorsDataBuilder(); |
| 77 |
| 78 /// Creates the [MirrorsResolutionAnalysis] for this strategy. |
| 79 // TODO(johnniwinther): Avoid passing [JavaScriptBackend]. |
| 80 MirrorsResolutionAnalysis createMirrorsResolutionAnalysis( |
| 81 JavaScriptBackend backend); |
| 82 |
| 83 /// Creates the [RuntimeTypesNeedBuilder] for this strategy. |
| 84 RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder(); |
| 44 } | 85 } |
| 45 | 86 |
| 46 /// Class that performs the mechanics to investigate annotations in the code. | 87 /// Class that performs the mechanics to investigate annotations in the code. |
| 47 abstract class AnnotationProcessor { | 88 abstract class AnnotationProcessor { |
| 48 void extractNativeAnnotations( | 89 void extractNativeAnnotations( |
| 49 LibraryEntity library, NativeBasicDataBuilder nativeBasicDataBuilder); | 90 LibraryEntity library, NativeBasicDataBuilder nativeBasicDataBuilder); |
| 50 | 91 |
| 51 void extractJsInteropAnnotations( | 92 void extractJsInteropAnnotations( |
| 52 LibraryEntity library, NativeBasicDataBuilder nativeBasicDataBuilder); | 93 LibraryEntity library, NativeBasicDataBuilder nativeBasicDataBuilder); |
| 53 } | 94 } |
| OLD | NEW |