| 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 'package:front_end/src/fasta/scanner.dart' show Token; | 7 import 'package:front_end/src/fasta/scanner.dart' show Token; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common_elements.dart'; | 10 import '../common_elements.dart'; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 AnnotationProcessor get annotationProcesser => | 90 AnnotationProcessor get annotationProcesser => |
| 91 _annotationProcessor ??= new _ElementAnnotationProcessor(_compiler); | 91 _annotationProcessor ??= new _ElementAnnotationProcessor(_compiler); |
| 92 | 92 |
| 93 @override | 93 @override |
| 94 NativeClassFinder createNativeClassFinder(NativeBasicData nativeBasicData) { | 94 NativeClassFinder createNativeClassFinder(NativeBasicData nativeBasicData) { |
| 95 return new ResolutionNativeClassFinder( | 95 return new ResolutionNativeClassFinder( |
| 96 _compiler.resolution, | 96 _compiler.resolution, |
| 97 _compiler.reporter, | 97 _compiler.reporter, |
| 98 elementEnvironment, | 98 elementEnvironment, |
| 99 _compiler.commonElements, | 99 commonElements, |
| 100 nativeBasicData); | 100 nativeBasicData); |
| 101 } | 101 } |
| 102 | 102 |
| 103 NoSuchMethodResolver createNoSuchMethodResolver() => | 103 NoSuchMethodResolver createNoSuchMethodResolver() => |
| 104 new ResolutionNoSuchMethodResolver(); | 104 new ResolutionNoSuchMethodResolver(); |
| 105 | 105 |
| 106 MirrorsDataBuilder createMirrorsDataBuilder() { | 106 MirrorsDataBuilder createMirrorsDataBuilder() { |
| 107 return new MirrorsDataImpl( | 107 return new MirrorsDataImpl(_compiler, _compiler.options, commonElements); |
| 108 _compiler, _compiler.options, _compiler.commonElements); | |
| 109 } | 108 } |
| 110 | 109 |
| 111 MirrorsResolutionAnalysis createMirrorsResolutionAnalysis( | 110 MirrorsResolutionAnalysis createMirrorsResolutionAnalysis( |
| 112 JavaScriptBackend backend) => | 111 JavaScriptBackend backend) => |
| 113 new MirrorsResolutionAnalysisImpl(backend, _compiler.resolution); | 112 new MirrorsResolutionAnalysisImpl(backend, _compiler.resolution); |
| 114 | 113 |
| 115 RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder() { | 114 RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder() { |
| 116 return new ResolutionRuntimeTypesNeedBuilderImpl( | 115 return new ResolutionRuntimeTypesNeedBuilderImpl( |
| 117 elementEnvironment, _compiler.types); | 116 elementEnvironment, _compiler.types); |
| 118 } | 117 } |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 /// very early in the compilation pipeline, typically this is before resolution | 643 /// very early in the compilation pipeline, typically this is before resolution |
| 645 /// is complete. Because of that this processor does a lightweight parse of the | 644 /// is complete. Because of that this processor does a lightweight parse of the |
| 646 /// annotation (which is restricted to a limited subset of the annotation | 645 /// annotation (which is restricted to a limited subset of the annotation |
| 647 /// syntax), and, once resolution completes, it validates that the parsed | 646 /// syntax), and, once resolution completes, it validates that the parsed |
| 648 /// annotations correspond to the correct element. | 647 /// annotations correspond to the correct element. |
| 649 class _ElementAnnotationProcessor implements AnnotationProcessor { | 648 class _ElementAnnotationProcessor implements AnnotationProcessor { |
| 650 Compiler _compiler; | 649 Compiler _compiler; |
| 651 | 650 |
| 652 _ElementAnnotationProcessor(this._compiler); | 651 _ElementAnnotationProcessor(this._compiler); |
| 653 | 652 |
| 654 CommonElements get _commonElements => _compiler.commonElements; | 653 CommonElements get _commonElements => _compiler.resolution.commonElements; |
| 655 | 654 |
| 656 /// Check whether [cls] has a `@Native(...)` annotation, and if so, set its | 655 /// Check whether [cls] has a `@Native(...)` annotation, and if so, set its |
| 657 /// native name from the annotation. | 656 /// native name from the annotation. |
| 658 void extractNativeAnnotations( | 657 void extractNativeAnnotations( |
| 659 LibraryElement library, NativeBasicDataBuilder nativeBasicDataBuilder) { | 658 LibraryElement library, NativeBasicDataBuilder nativeBasicDataBuilder) { |
| 660 library.forEachLocalMember((Element element) { | 659 library.forEachLocalMember((Element element) { |
| 661 if (element.isClass) { | 660 if (element.isClass) { |
| 662 EagerAnnotationHandler.checkAnnotation(_compiler, element, | 661 EagerAnnotationHandler.checkAnnotation(_compiler, element, |
| 663 new NativeAnnotationHandler(nativeBasicDataBuilder)); | 662 new NativeAnnotationHandler(nativeBasicDataBuilder)); |
| 664 } | 663 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 @override | 841 @override |
| 843 WorkItem createWorkItem(MemberElement element) { | 842 WorkItem createWorkItem(MemberElement element) { |
| 844 assert(element.isDeclaration, failedAt(element)); | 843 assert(element.isDeclaration, failedAt(element)); |
| 845 if (element.isMalformed) return null; | 844 if (element.isMalformed) return null; |
| 846 | 845 |
| 847 assert(element is AnalyzableElement, | 846 assert(element is AnalyzableElement, |
| 848 failedAt(element, 'Element $element is not analyzable.')); | 847 failedAt(element, 'Element $element is not analyzable.')); |
| 849 return _resolution.createWorkItem(element); | 848 return _resolution.createWorkItem(element); |
| 850 } | 849 } |
| 851 } | 850 } |
| OLD | NEW |