| 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.resolution_strategy; | 5 library dart2js.resolution_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/resolution.dart'; | 10 import '../common/resolution.dart'; |
| 10 import '../common/tasks.dart'; | 11 import '../common/tasks.dart'; |
| 11 import '../compiler.dart'; | 12 import '../compiler.dart'; |
| 12 import '../elements/elements.dart'; | 13 import '../elements/elements.dart'; |
| 13 import '../elements/entities.dart'; | 14 import '../elements/entities.dart'; |
| 14 import '../elements/resolution_types.dart'; | 15 import '../elements/resolution_types.dart'; |
| 15 import '../environment.dart'; | 16 import '../environment.dart'; |
| 17 import '../enqueue.dart'; |
| 16 import '../frontend_strategy.dart'; | 18 import '../frontend_strategy.dart'; |
| 19 import '../js_backend/backend.dart'; |
| 20 import '../js_backend/backend_usage.dart'; |
| 21 import '../js_backend/custom_elements_analysis.dart'; |
| 22 import '../js_backend/mirrors_analysis.dart'; |
| 23 import '../js_backend/mirrors_data.dart'; |
| 17 import '../js_backend/native_data.dart'; | 24 import '../js_backend/native_data.dart'; |
| 25 import '../js_backend/no_such_method_registry.dart'; |
| 18 import '../library_loader.dart'; | 26 import '../library_loader.dart'; |
| 19 import '../native/resolver.dart'; | 27 import '../native/resolver.dart'; |
| 20 import '../serialization/task.dart'; | 28 import '../serialization/task.dart'; |
| 21 import '../patch_parser.dart'; | 29 import '../patch_parser.dart'; |
| 22 import '../resolved_uri_translator.dart'; | 30 import '../resolved_uri_translator.dart'; |
| 23 import '../universe/call_structure.dart'; | 31 import '../universe/call_structure.dart'; |
| 32 import '../universe/world_builder.dart'; |
| 24 | 33 |
| 25 /// [FrontendStrategy] that loads '.dart' files and creates a resolved element | 34 /// [FrontendStrategy] that loads '.dart' files and creates a resolved element |
| 26 /// model using the resolver. | 35 /// model using the resolver. |
| 27 class ResolutionFrontEndStrategy implements FrontEndStrategy { | 36 class ResolutionFrontEndStrategy implements FrontEndStrategy { |
| 28 final Compiler _compiler; | 37 final Compiler _compiler; |
| 29 final ElementEnvironment elementEnvironment; | 38 final ElementEnvironment elementEnvironment; |
| 30 AnnotationProcessor _annotationProcessor; | 39 AnnotationProcessor _annotationProcessor; |
| 31 | 40 |
| 32 ResolutionFrontEndStrategy(this._compiler) | 41 ResolutionFrontEndStrategy(this._compiler) |
| 33 : elementEnvironment = new _CompilerElementEnvironment(_compiler); | 42 : elementEnvironment = new _CompilerElementEnvironment(_compiler); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 60 @override | 69 @override |
| 61 NativeClassResolver createNativeClassResolver( | 70 NativeClassResolver createNativeClassResolver( |
| 62 NativeBasicData nativeBasicData) { | 71 NativeBasicData nativeBasicData) { |
| 63 return new ResolutionNativeClassResolver( | 72 return new ResolutionNativeClassResolver( |
| 64 _compiler.resolution, | 73 _compiler.resolution, |
| 65 _compiler.reporter, | 74 _compiler.reporter, |
| 66 elementEnvironment, | 75 elementEnvironment, |
| 67 _compiler.commonElements, | 76 _compiler.commonElements, |
| 68 nativeBasicData); | 77 nativeBasicData); |
| 69 } | 78 } |
| 79 |
| 80 NoSuchMethodResolver createNoSuchMethodResolver() => |
| 81 new NoSuchMethodResolverImpl(); |
| 82 |
| 83 CustomElementsResolutionAnalysis createCustomElementsResolutionAnalysis( |
| 84 NativeBasicData nativeBasicData, |
| 85 BackendUsageBuilder backendUsageBuilder) { |
| 86 return new CustomElementsResolutionAnalysis( |
| 87 _compiler.resolution, |
| 88 _compiler.backend.constantSystem, |
| 89 _compiler.commonElements, |
| 90 nativeBasicData, |
| 91 backendUsageBuilder); |
| 92 } |
| 93 |
| 94 MirrorsDataBuilder createMirrorsDataBuilder() { |
| 95 return new MirrorsDataImpl( |
| 96 _compiler, _compiler.options, _compiler.commonElements); |
| 97 } |
| 98 |
| 99 MirrorsResolutionAnalysis createMirrorsResolutionAnalysis( |
| 100 JavaScriptBackend backend) => |
| 101 new MirrorsResolutionAnalysisImpl(backend, _compiler.resolution); |
| 102 |
| 103 RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder() { |
| 104 return new RuntimeTypesNeedBuilderImpl(); |
| 105 } |
| 106 |
| 107 ResolutionWorldBuilder createResolutionWorldBuilder( |
| 108 NativeBasicData nativeBasicData, |
| 109 SelectorConstraintsStrategy selectorConstraintsStrategy) { |
| 110 return new ElementResolutionWorldBuilder( |
| 111 _compiler.backend, _compiler.resolution, selectorConstraintsStrategy); |
| 112 } |
| 113 |
| 114 WorkItemBuilder createResolutionWorkItemBuilder( |
| 115 ImpactTransformer impactTransformer) { |
| 116 return new ResolutionWorkItemBuilder(_compiler.resolution); |
| 117 } |
| 70 } | 118 } |
| 71 | 119 |
| 72 /// An element environment base on a [Compiler]. | 120 /// An element environment base on a [Compiler]. |
| 73 class _CompilerElementEnvironment implements ElementEnvironment { | 121 class _CompilerElementEnvironment implements ElementEnvironment { |
| 74 final Compiler _compiler; | 122 final Compiler _compiler; |
| 75 | 123 |
| 76 _CompilerElementEnvironment(this._compiler); | 124 _CompilerElementEnvironment(this._compiler); |
| 77 | 125 |
| 78 LibraryProvider get _libraryProvider => _compiler.libraryLoader; | 126 LibraryProvider get _libraryProvider => _compiler.libraryLoader; |
| 79 Resolution get _resolution => _compiler.resolution; | 127 Resolution get _resolution => _compiler.resolution; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 library.forEachLocalMember((Element element) { | 378 library.forEachLocalMember((Element element) { |
| 331 if (element.isClass) { | 379 if (element.isClass) { |
| 332 ClassElement cls = element; | 380 ClassElement cls = element; |
| 333 if (checkJsInteropAnnotation(element)) { | 381 if (checkJsInteropAnnotation(element)) { |
| 334 nativeBasicDataBuilder.markAsJsInteropClass(cls); | 382 nativeBasicDataBuilder.markAsJsInteropClass(cls); |
| 335 } | 383 } |
| 336 } | 384 } |
| 337 }); | 385 }); |
| 338 } | 386 } |
| 339 } | 387 } |
| OLD | NEW |