Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution_strategy.dart

Issue 2982733002: Use entities in most of MirrorsData (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_strategy.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 _compiler.reporter, 101 _compiler.reporter,
102 elementEnvironment, 102 elementEnvironment,
103 commonElements, 103 commonElements,
104 nativeBasicData); 104 nativeBasicData);
105 } 105 }
106 106
107 NoSuchMethodResolver createNoSuchMethodResolver() => 107 NoSuchMethodResolver createNoSuchMethodResolver() =>
108 new ResolutionNoSuchMethodResolver(); 108 new ResolutionNoSuchMethodResolver();
109 109
110 MirrorsDataBuilder createMirrorsDataBuilder() { 110 MirrorsDataBuilder createMirrorsDataBuilder() {
111 return new MirrorsDataImpl(_compiler, _compiler.options, commonElements); 111 return new MirrorsDataImpl(
112 _compiler, _compiler.options, elementEnvironment, commonElements);
112 } 113 }
113 114
114 MirrorsResolutionAnalysis createMirrorsResolutionAnalysis( 115 MirrorsResolutionAnalysis createMirrorsResolutionAnalysis(
115 JavaScriptBackend backend) => 116 JavaScriptBackend backend) =>
116 new MirrorsResolutionAnalysisImpl(backend, _compiler.resolution); 117 new MirrorsResolutionAnalysisImpl(backend, _compiler.resolution);
117 118
118 RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder() { 119 RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder() {
119 return new ResolutionRuntimeTypesNeedBuilderImpl( 120 return new ResolutionRuntimeTypesNeedBuilderImpl(
120 elementEnvironment, dartTypes); 121 elementEnvironment, dartTypes);
121 } 122 }
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 return function.type; 658 return function.type;
658 } 659 }
659 660
660 @override 661 @override
661 ResolutionDartType getUnaliasedType(covariant ResolutionDartType type) { 662 ResolutionDartType getUnaliasedType(covariant ResolutionDartType type) {
662 type.computeUnaliased(_resolution); 663 type.computeUnaliased(_resolution);
663 return type.unaliased; 664 return type.unaliased;
664 } 665 }
665 666
666 @override 667 @override
667 Iterable<ConstantValue> getMemberMetadata(covariant MemberElement element) { 668 Iterable<ConstantValue> getMemberMetadata(covariant MemberElement element,
669 {bool includeParameterMetadata: false}) {
668 List<ConstantValue> values = <ConstantValue>[]; 670 List<ConstantValue> values = <ConstantValue>[];
671 values.addAll(_getMetadataOf(element));
672 if (includeParameterMetadata) {
673 if (element.isFunction || element.isConstructor || element.isSetter) {
674 MethodElement function = element.implementation;
675 function.functionSignature.forEachParameter(
676 (parameter) => values.addAll(_getMetadataOf(parameter)));
677 }
678 }
679 return values;
680 }
681
682 @override
683 Iterable<ConstantValue> getLibraryMetadata(covariant LibraryElement element) {
684 return _getMetadataOf(element);
685 }
686
687 @override
688 Iterable<ConstantValue> getClassMetadata(covariant ClassElement element) {
689 return _getMetadataOf(element);
690 }
691
692 @override
693 Iterable<ConstantValue> getTypedefMetadata(covariant TypedefElement element) {
694 return _getMetadataOf(element);
695 }
696
697 Iterable<ConstantValue> _getMetadataOf(Element element) {
698 List<ConstantValue> constants = <ConstantValue>[];
669 _compiler.reporter.withCurrentElement(element, () { 699 _compiler.reporter.withCurrentElement(element, () {
670 for (MetadataAnnotation metadata in element.implementation.metadata) { 700 for (MetadataAnnotation metadata in element.implementation.metadata) {
671 metadata.ensureResolved(_compiler.resolution); 701 metadata.ensureResolved(_compiler.resolution);
672 assert(metadata.constant != null, 702 assert(metadata.constant != null,
673 failedAt(metadata, "Unevaluated metadata constant.")); 703 failedAt(metadata, "Unevaluated metadata constant."));
674 ConstantValue value = 704 constants.add(
675 _compiler.constants.getConstantValue(metadata.constant); 705 _compiler.backend.constants.getConstantValue(metadata.constant));
676 values.add(value);
677 } 706 }
678 }); 707 });
679 return values; 708 return constants;
680 } 709 }
681 710
682 @override 711 @override
683 ResolutionFunctionType getFunctionTypeOfTypedef( 712 ResolutionFunctionType getFunctionTypeOfTypedef(
684 covariant TypedefElement typedef) { 713 covariant TypedefElement typedef) {
685 return typedef.alias; 714 return typedef.alias;
686 } 715 }
687 } 716 }
688 717
689 /// AST-based logic for processing annotations. These annotations are processed 718 /// AST-based logic for processing annotations. These annotations are processed
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 @override 916 @override
888 WorkItem createWorkItem(MemberElement element) { 917 WorkItem createWorkItem(MemberElement element) {
889 assert(element.isDeclaration, failedAt(element)); 918 assert(element.isDeclaration, failedAt(element));
890 if (element.isMalformed) return null; 919 if (element.isMalformed) return null;
891 920
892 assert(element is AnalyzableElement, 921 assert(element is AnalyzableElement,
893 failedAt(element, 'Element $element is not analyzable.')); 922 failedAt(element, 'Element $element is not analyzable.'));
894 return _resolution.createWorkItem(element); 923 return _resolution.createWorkItem(element);
895 } 924 }
896 } 925 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_strategy.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698