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

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

Issue 3008793002: Use the entity model for dump_info. (Closed)
Patch Set: Created 3 years, 3 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
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 '../../compiler_new.dart' as api; 9 import '../../compiler_new.dart' as api;
10 import '../common.dart'; 10 import '../common.dart';
11 import '../common_elements.dart';
12 import '../common/backend_api.dart'; 11 import '../common/backend_api.dart';
13 import '../common/names.dart'; 12 import '../common/names.dart';
14 import '../common/resolution.dart'; 13 import '../common/resolution.dart';
15 import '../common/tasks.dart'; 14 import '../common/tasks.dart';
16 import '../common/work.dart'; 15 import '../common/work.dart';
16 import '../common_elements.dart';
17 import '../compiler.dart'; 17 import '../compiler.dart';
18 import '../constants/expressions.dart' show ConstantExpression;
18 import '../constants/values.dart'; 19 import '../constants/values.dart';
19 import '../elements/elements.dart'; 20 import '../elements/elements.dart';
20 import '../elements/entities.dart'; 21 import '../elements/entities.dart';
21 import '../elements/modelx.dart'; 22 import '../elements/modelx.dart';
22 import '../elements/resolution_types.dart'; 23 import '../elements/resolution_types.dart';
23 import '../elements/types.dart'; 24 import '../elements/types.dart';
25 import '../enqueue.dart';
24 import '../environment.dart'; 26 import '../environment.dart';
25 import '../enqueue.dart';
26 import '../frontend_strategy.dart'; 27 import '../frontend_strategy.dart';
27 import '../js_backend/backend.dart'; 28 import '../js_backend/backend.dart';
28 import '../js_backend/backend_usage.dart'; 29 import '../js_backend/backend_usage.dart';
29 import '../js_backend/interceptor_data.dart'; 30 import '../js_backend/interceptor_data.dart';
30 import '../js_backend/mirrors_analysis.dart'; 31 import '../js_backend/mirrors_analysis.dart';
31 import '../js_backend/mirrors_data.dart'; 32 import '../js_backend/mirrors_data.dart';
32 import '../js_backend/native_data.dart'; 33 import '../js_backend/native_data.dart';
33 import '../js_backend/no_such_method_registry.dart'; 34 import '../js_backend/no_such_method_registry.dart';
34 import '../js_backend/runtime_types.dart'; 35 import '../js_backend/runtime_types.dart';
35 import '../library_loader.dart'; 36 import '../library_loader.dart';
36 import '../native/enqueue.dart' show NativeResolutionEnqueuer; 37 import '../native/enqueue.dart' show NativeResolutionEnqueuer;
37 import '../native/resolver.dart'; 38 import '../native/resolver.dart';
38 import '../options.dart'; 39 import '../options.dart';
39 import '../tree/tree.dart' show Node;
40 import '../serialization/task.dart';
41 import '../patch_parser.dart'; 40 import '../patch_parser.dart';
42 import '../resolved_uri_translator.dart'; 41 import '../resolved_uri_translator.dart';
42 import '../serialization/task.dart';
43 import '../tree/tree.dart' show Node;
43 import '../universe/call_structure.dart'; 44 import '../universe/call_structure.dart';
44 import '../universe/use.dart'; 45 import '../universe/use.dart';
45 import '../universe/world_builder.dart'; 46 import '../universe/world_builder.dart';
46 import '../universe/world_impact.dart'; 47 import '../universe/world_impact.dart';
47 import 'no_such_method_resolver.dart'; 48 import 'no_such_method_resolver.dart';
48 49
49 /// [FrontendStrategy] that loads '.dart' files and creates a resolved element 50 /// [FrontendStrategy] that loads '.dart' files and creates a resolved element
50 /// model using the resolver. 51 /// model using the resolver.
51 class ResolutionFrontEndStrategy extends FrontendStrategyBase 52 class ResolutionFrontEndStrategy extends FrontendStrategyBase
52 with ComputeSpannableMixin { 53 with ComputeSpannableMixin {
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 MemberElement member = _member; 511 MemberElement member = _member;
511 if (member.isSynthesized) return; 512 if (member.isSynthesized) return;
512 if (member.isMalformed) return; 513 if (member.isMalformed) return;
513 if (member.isConstructor) return; 514 if (member.isConstructor) return;
514 f(declarer, member); 515 f(declarer, member);
515 }, includeSuperAndInjectedMembers: true); 516 }, includeSuperAndInjectedMembers: true);
516 } 517 }
517 518
518 @override 519 @override
519 void forEachConstructor( 520 void forEachConstructor(
520 covariant ClassElement cls, void f(ConstructorEntity constructor)) { 521 covariant ClassElement cls, void f(ConstructorEntity constructor),
521 cls.ensureResolved(_resolution); 522 {bool ensureResolved: true}) {
523 if (ensureResolved) cls.ensureResolved(_resolution);
522 for (ConstructorElement constructor in cls.implementation.constructors) { 524 for (ConstructorElement constructor in cls.implementation.constructors) {
523 _resolution.ensureResolved(constructor.declaration); 525 if (ensureResolved) _resolution.ensureResolved(constructor.declaration);
524 if (constructor.isRedirectingFactory) continue; 526 if (constructor.isRedirectingFactory) continue;
525 f(constructor); 527 f(constructor);
526 } 528 }
527 } 529 }
528 530
529 @override 531 @override
530 void forEachConstructorBody( 532 void forEachConstructorBody(
531 covariant ClassElement cls, void f(ConstructorBodyEntity constructor)) { 533 covariant ClassElement cls, void f(ConstructorBodyEntity constructor)) {
532 cls.forEachConstructorBody(f); 534 cls.forEachConstructorBody(f);
533 } 535 }
534 536
535 @override 537 @override
538 void forEachNestedClosure(
539 covariant MemberElement member, void f(FunctionEntity closure)) {
540 for (var closure in member.nestedClosures) {
541 f(closure);
542 }
543 }
544
545 @override
536 ClassEntity getSuperClass(covariant ClassElement cls, 546 ClassEntity getSuperClass(covariant ClassElement cls,
537 {bool skipUnnamedMixinApplications: false}) { 547 {bool skipUnnamedMixinApplications: false}) {
538 cls.ensureResolved(_resolution); 548 cls.ensureResolved(_resolution);
539 ClassElement superclass = cls.superclass; 549 ClassElement superclass = cls.superclass;
540 if (skipUnnamedMixinApplications) { 550 if (skipUnnamedMixinApplications) {
541 while (superclass != null && superclass.isUnnamedMixinApplication) { 551 while (superclass != null && superclass.isUnnamedMixinApplication) {
542 superclass = superclass.superclass; 552 superclass = superclass.superclass;
543 } 553 }
544 } 554 }
545 return superclass; 555 return superclass;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 return field.type; 683 return field.type;
674 } 684 }
675 685
676 @override 686 @override
677 ResolutionFunctionType getLocalFunctionType( 687 ResolutionFunctionType getLocalFunctionType(
678 covariant LocalFunctionElement function) { 688 covariant LocalFunctionElement function) {
679 return function.type; 689 return function.type;
680 } 690 }
681 691
682 @override 692 @override
693 ConstantExpression getFieldConstant(covariant FieldElement field) {
694 return field.constant;
695 }
696
697 @override
683 ResolutionDartType getUnaliasedType(covariant ResolutionDartType type) { 698 ResolutionDartType getUnaliasedType(covariant ResolutionDartType type) {
684 type.computeUnaliased(_resolution); 699 type.computeUnaliased(_resolution);
685 return type.unaliased; 700 return type.unaliased;
686 } 701 }
687 702
688 @override 703 @override
689 Iterable<ConstantValue> getMemberMetadata(covariant MemberElement element, 704 Iterable<ConstantValue> getMemberMetadata(covariant MemberElement element,
690 {bool includeParameterMetadata: false}) { 705 {bool includeParameterMetadata: false}) {
691 List<ConstantValue> values = <ConstantValue>[]; 706 List<ConstantValue> values = <ConstantValue>[];
692 values.addAll(_getMetadataOf(element)); 707 values.addAll(_getMetadataOf(element));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 } 742 }
728 }); 743 });
729 return constants; 744 return constants;
730 } 745 }
731 746
732 @override 747 @override
733 ResolutionFunctionType getFunctionTypeOfTypedef( 748 ResolutionFunctionType getFunctionTypeOfTypedef(
734 covariant TypedefElement typedef) { 749 covariant TypedefElement typedef) {
735 return typedef.alias; 750 return typedef.alias;
736 } 751 }
752
753 @override
754 bool hasBeenResolved(covariant Element element) {
755 return _compiler.resolution.hasBeenResolved(element);
756 }
757
758 @override
759 bool hasClassBeenResolved(covariant ClassElement cls) {
760 return cls.isResolved;
761 }
737 } 762 }
738 763
739 /// AST-based logic for processing annotations. These annotations are processed 764 /// AST-based logic for processing annotations. These annotations are processed
740 /// very early in the compilation pipeline, typically this is before resolution 765 /// very early in the compilation pipeline, typically this is before resolution
741 /// is complete. Because of that this processor does a lightweight parse of the 766 /// is complete. Because of that this processor does a lightweight parse of the
742 /// annotation (which is restricted to a limited subset of the annotation 767 /// annotation (which is restricted to a limited subset of the annotation
743 /// syntax), and, once resolution completes, it validates that the parsed 768 /// syntax), and, once resolution completes, it validates that the parsed
744 /// annotations correspond to the correct element. 769 /// annotations correspond to the correct element.
745 class _ElementAnnotationProcessor implements AnnotationProcessor { 770 class _ElementAnnotationProcessor implements AnnotationProcessor {
746 final Compiler _compiler; 771 final Compiler _compiler;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 983
959 @override 984 @override
960 void forEachConstructor( 985 void forEachConstructor(
961 covariant ClassElement cls, void f(ConstructorEntity constructor)) { 986 covariant ClassElement cls, void f(ConstructorEntity constructor)) {
962 cls.constructors.forEach((Element _constructor) { 987 cls.constructors.forEach((Element _constructor) {
963 ConstructorElement constructor = _constructor; 988 ConstructorElement constructor = _constructor;
964 f(constructor); 989 f(constructor);
965 }); 990 });
966 } 991 }
967 } 992 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698