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

Side by Side Diff: runtime/vm/kernel.h

Issue 2782913003: Revert "Remove definitions from Kernel canonical names." (Closed)
Patch Set: Created 3 years, 8 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/kernel/lib/canonical_name.dart ('k') | runtime/vm/kernel.cc » ('j') | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 #ifndef RUNTIME_VM_KERNEL_H_ 5 #ifndef RUNTIME_VM_KERNEL_H_
6 #define RUNTIME_VM_KERNEL_H_ 6 #define RUNTIME_VM_KERNEL_H_
7 7
8 #if !defined(DART_PRECOMPILED_RUNTIME) 8 #if !defined(DART_PRECOMPILED_RUNTIME)
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 M(TreeNode) \ 111 M(TreeNode) \
112 KERNEL_TREE_NODES_DO(M) 112 KERNEL_TREE_NODES_DO(M)
113 113
114 #define KERNEL_VISITORS_DO(M) \ 114 #define KERNEL_VISITORS_DO(M) \
115 M(ExpressionVisitor) \ 115 M(ExpressionVisitor) \
116 M(StatementVisitor) \ 116 M(StatementVisitor) \
117 M(MemberVisitor) \ 117 M(MemberVisitor) \
118 M(ClassVisitor) \ 118 M(ClassVisitor) \
119 M(InitializerVisitor) \ 119 M(InitializerVisitor) \
120 M(DartTypeVisitor) \ 120 M(DartTypeVisitor) \
121 M(ClassReferenceVisitor) \
122 M(MemberReferenceVisitor) \
121 M(TreeVisitor) \ 123 M(TreeVisitor) \
122 M(Visitor) 124 M(Visitor)
123 125
124 namespace dart { 126 namespace dart {
125 127
126 class Field; 128 class Field;
127 class ParsedFunction; 129 class ParsedFunction;
128 class Zone; 130 class Zone;
129 131
130 namespace kernel { 132 namespace kernel {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 class LinkedNode; 363 class LinkedNode;
362 class Member; 364 class Member;
363 class Procedure; 365 class Procedure;
364 366
365 class CanonicalName { 367 class CanonicalName {
366 public: 368 public:
367 ~CanonicalName(); 369 ~CanonicalName();
368 370
369 String* name() { return name_; } 371 String* name() { return name_; }
370 CanonicalName* parent() { return parent_; } 372 CanonicalName* parent() { return parent_; }
373 LinkedNode* definition() { return definition_; }
371 bool is_referenced() { return is_referenced_; } 374 bool is_referenced() { return is_referenced_; }
372 void set_referenced(bool referenced) { is_referenced_ = referenced; } 375 void set_referenced(bool referenced) { is_referenced_ = referenced; }
373 376
377 void BindTo(LinkedNode* definition);
378 void Unbind();
374 CanonicalName* AddChild(String* name); 379 CanonicalName* AddChild(String* name);
375 380
376 bool IsAdministrative(); 381 Library* AsLibrary();
377 bool IsPrivate(); 382 Class* AsClass();
378 383 Member* AsMember();
379 bool IsRoot(); 384 Field* AsField();
380 bool IsLibrary(); 385 Constructor* AsConstructor();
381 bool IsClass(); 386 Procedure* AsProcedure();
382 bool IsMember();
383 bool IsField();
384 bool IsConstructor();
385 bool IsProcedure();
386 bool IsMethod();
387 bool IsGetter();
388 bool IsSetter();
389 bool IsFactory();
390
391 // For a member (field, constructor, or procedure) return the canonical name
392 // of the enclosing class or library.
393 CanonicalName* EnclosingName();
394 387
395 static CanonicalName* NewRoot(); 388 static CanonicalName* NewRoot();
396 389
397 private: 390 private:
398 CanonicalName(); 391 CanonicalName();
399 392
400 bool is_referenced_; 393 bool is_referenced_;
401 Ref<CanonicalName> parent_; 394 Ref<CanonicalName> parent_;
402 Ref<String> name_; 395 Ref<String> name_;
396 Ref<LinkedNode> definition_;
403 MallocGrowableArray<CanonicalName*> children_; 397 MallocGrowableArray<CanonicalName*> children_;
404 398
405 DISALLOW_COPY_AND_ASSIGN(CanonicalName); 399 DISALLOW_COPY_AND_ASSIGN(CanonicalName);
406 }; 400 };
407 401
408 402
409 class Node { 403 class Node {
410 public: 404 public:
411 virtual ~Node(); 405 virtual ~Node();
412 406
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 450
457 class LinkedNode : public TreeNode { 451 class LinkedNode : public TreeNode {
458 public: 452 public:
459 virtual ~LinkedNode(); 453 virtual ~LinkedNode();
460 454
461 CanonicalName* canonical_name() { return canonical_name_; } 455 CanonicalName* canonical_name() { return canonical_name_; }
462 456
463 protected: 457 protected:
464 LinkedNode() {} 458 LinkedNode() {}
465 459
460 private:
466 Ref<CanonicalName> canonical_name_; 461 Ref<CanonicalName> canonical_name_;
467 462
468 private:
469 friend class CanonicalName; 463 friend class CanonicalName;
470 464
471 DISALLOW_COPY_AND_ASSIGN(LinkedNode); 465 DISALLOW_COPY_AND_ASSIGN(LinkedNode);
472 }; 466 };
473 467
474 468
475 class Library : public LinkedNode { 469 class Library : public LinkedNode {
476 public: 470 public:
477 Library* ReadFrom(Reader* reader); 471 Library* ReadFrom(Reader* reader);
478 472
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 class Class : public LinkedNode { 526 class Class : public LinkedNode {
533 public: 527 public:
534 Class* ReadFrom(Reader* reader); 528 Class* ReadFrom(Reader* reader);
535 529
536 virtual ~Class(); 530 virtual ~Class();
537 531
538 DEFINE_CASTING_OPERATIONS(Class); 532 DEFINE_CASTING_OPERATIONS(Class);
539 533
540 virtual void AcceptTreeVisitor(TreeVisitor* visitor); 534 virtual void AcceptTreeVisitor(TreeVisitor* visitor);
541 virtual void AcceptClassVisitor(ClassVisitor* visitor) = 0; 535 virtual void AcceptClassVisitor(ClassVisitor* visitor) = 0;
536 virtual void AcceptReferenceVisitor(ClassReferenceVisitor* visitor) = 0;
542 537
543 Library* parent() { return parent_; } 538 Library* parent() { return parent_; }
544 String* name() { return name_; } 539 String* name() { return name_; }
545 intptr_t source_uri_index() { return source_uri_index_; } 540 intptr_t source_uri_index() { return source_uri_index_; }
546 bool is_abstract() { return is_abstract_; } 541 bool is_abstract() { return is_abstract_; }
547 List<Expression>& annotations() { return annotations_; } 542 List<Expression>& annotations() { return annotations_; }
548 TokenPosition position() { return position_; } 543 TokenPosition position() { return position_; }
549 544
550 virtual List<TypeParameter>& type_parameters() = 0; 545 virtual List<TypeParameter>& type_parameters() = 0;
551 virtual List<InterfaceType>& implemented_classes() = 0; 546 virtual List<InterfaceType>& implemented_classes() = 0;
(...skipping 21 matching lines...) Expand all
573 568
574 class NormalClass : public Class { 569 class NormalClass : public Class {
575 public: 570 public:
576 NormalClass* ReadFrom(Reader* reader); 571 NormalClass* ReadFrom(Reader* reader);
577 572
578 virtual ~NormalClass(); 573 virtual ~NormalClass();
579 574
580 DEFINE_CASTING_OPERATIONS(NormalClass); 575 DEFINE_CASTING_OPERATIONS(NormalClass);
581 576
582 virtual void AcceptClassVisitor(ClassVisitor* visitor); 577 virtual void AcceptClassVisitor(ClassVisitor* visitor);
578 virtual void AcceptReferenceVisitor(ClassReferenceVisitor* visitor);
583 virtual void VisitChildren(Visitor* visitor); 579 virtual void VisitChildren(Visitor* visitor);
584 580
585 virtual TypeParameterList& type_parameters() { return type_parameters_; } 581 virtual TypeParameterList& type_parameters() { return type_parameters_; }
586 InterfaceType* super_class() { return super_class_; } 582 InterfaceType* super_class() { return super_class_; }
587 virtual List<InterfaceType>& implemented_classes() { 583 virtual List<InterfaceType>& implemented_classes() {
588 return implemented_classes_; 584 return implemented_classes_;
589 } 585 }
590 virtual List<Constructor>& constructors() { return constructors_; } 586 virtual List<Constructor>& constructors() { return constructors_; }
591 virtual List<Procedure>& procedures() { return procedures_; } 587 virtual List<Procedure>& procedures() { return procedures_; }
592 virtual List<Field>& fields() { return fields_; } 588 virtual List<Field>& fields() { return fields_; }
(...skipping 17 matching lines...) Expand all
610 606
611 class MixinClass : public Class { 607 class MixinClass : public Class {
612 public: 608 public:
613 MixinClass* ReadFrom(Reader* reader); 609 MixinClass* ReadFrom(Reader* reader);
614 610
615 virtual ~MixinClass(); 611 virtual ~MixinClass();
616 612
617 DEFINE_CASTING_OPERATIONS(MixinClass); 613 DEFINE_CASTING_OPERATIONS(MixinClass);
618 614
619 virtual void AcceptClassVisitor(ClassVisitor* visitor); 615 virtual void AcceptClassVisitor(ClassVisitor* visitor);
616 virtual void AcceptReferenceVisitor(ClassReferenceVisitor* visitor);
620 virtual void VisitChildren(Visitor* visitor); 617 virtual void VisitChildren(Visitor* visitor);
621 618
622 virtual TypeParameterList& type_parameters() { return type_parameters_; } 619 virtual TypeParameterList& type_parameters() { return type_parameters_; }
623 InterfaceType* first() { return first_; } 620 InterfaceType* first() { return first_; }
624 InterfaceType* second() { return second_; } 621 InterfaceType* second() { return second_; }
625 virtual List<InterfaceType>& implemented_classes() { 622 virtual List<InterfaceType>& implemented_classes() {
626 return implemented_classes_; 623 return implemented_classes_;
627 } 624 }
628 virtual List<Constructor>& constructors() { return constructors_; } 625 virtual List<Constructor>& constructors() { return constructors_; }
629 virtual List<Field>& fields() { return fields_; } 626 virtual List<Field>& fields() { return fields_; }
(...skipping 20 matching lines...) Expand all
650 647
651 648
652 class Member : public LinkedNode { 649 class Member : public LinkedNode {
653 public: 650 public:
654 virtual ~Member(); 651 virtual ~Member();
655 652
656 DEFINE_CASTING_OPERATIONS(Member); 653 DEFINE_CASTING_OPERATIONS(Member);
657 654
658 virtual void AcceptTreeVisitor(TreeVisitor* visitor); 655 virtual void AcceptTreeVisitor(TreeVisitor* visitor);
659 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0; 656 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0;
657 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor) = 0;
660 658
661 TreeNode* parent() { return parent_; } 659 TreeNode* parent() { return parent_; }
662 Name* name() { return name_; } 660 Name* name() { return name_; }
663 List<Expression>& annotations() { return annotations_; } 661 List<Expression>& annotations() { return annotations_; }
664 TokenPosition position() { return position_; } 662 TokenPosition position() { return position_; }
665 TokenPosition end_position() { return end_position_; } 663 TokenPosition end_position() { return end_position_; }
666 664
667 protected: 665 protected:
668 Member() 666 Member()
669 : position_(TokenPosition::kNoSource), 667 : position_(TokenPosition::kNoSource),
(...skipping 21 matching lines...) Expand all
691 kFlagStatic = 1 << 2, 689 kFlagStatic = 1 << 2,
692 }; 690 };
693 691
694 Field* ReadFrom(Reader* reader); 692 Field* ReadFrom(Reader* reader);
695 693
696 virtual ~Field(); 694 virtual ~Field();
697 695
698 DEFINE_CASTING_OPERATIONS(Field); 696 DEFINE_CASTING_OPERATIONS(Field);
699 697
700 virtual void AcceptMemberVisitor(MemberVisitor* visitor); 698 virtual void AcceptMemberVisitor(MemberVisitor* visitor);
699 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor);
701 virtual void VisitChildren(Visitor* visitor); 700 virtual void VisitChildren(Visitor* visitor);
702 701
703 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } 702 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; }
704 bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; } 703 bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; }
705 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; } 704 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; }
706 intptr_t source_uri_index() { return source_uri_index_; } 705 intptr_t source_uri_index() { return source_uri_index_; }
707 706
708 DartType* type() { return type_; } 707 DartType* type() { return type_; }
709 Expression* initializer() { return initializer_; } 708 Expression* initializer() { return initializer_; }
710 709
(...skipping 19 matching lines...) Expand all
730 kFlagExternal = 1 << 1, 729 kFlagExternal = 1 << 1,
731 }; 730 };
732 731
733 Constructor* ReadFrom(Reader* reader); 732 Constructor* ReadFrom(Reader* reader);
734 733
735 virtual ~Constructor(); 734 virtual ~Constructor();
736 735
737 DEFINE_CASTING_OPERATIONS(Constructor); 736 DEFINE_CASTING_OPERATIONS(Constructor);
738 737
739 virtual void AcceptMemberVisitor(MemberVisitor* visitor); 738 virtual void AcceptMemberVisitor(MemberVisitor* visitor);
739 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor);
740 virtual void VisitChildren(Visitor* visitor); 740 virtual void VisitChildren(Visitor* visitor);
741 741
742 bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; } 742 bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; }
743 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } 743 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; }
744 744
745 FunctionNode* function() { return function_; } 745 FunctionNode* function() { return function_; }
746 List<Initializer>& initializers() { return initializers_; } 746 List<Initializer>& initializers() { return initializers_; }
747 747
748 private: 748 private:
749 template <typename T> 749 template <typename T>
(...skipping 29 matching lines...) Expand all
779 kIncompleteProcedure = 255 779 kIncompleteProcedure = 255
780 }; 780 };
781 781
782 Procedure* ReadFrom(Reader* reader); 782 Procedure* ReadFrom(Reader* reader);
783 783
784 virtual ~Procedure(); 784 virtual ~Procedure();
785 785
786 DEFINE_CASTING_OPERATIONS(Procedure); 786 DEFINE_CASTING_OPERATIONS(Procedure);
787 787
788 virtual void AcceptMemberVisitor(MemberVisitor* visitor); 788 virtual void AcceptMemberVisitor(MemberVisitor* visitor);
789 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor);
789 virtual void VisitChildren(Visitor* visitor); 790 virtual void VisitChildren(Visitor* visitor);
790 791
791 ProcedureKind kind() { return kind_; } 792 ProcedureKind kind() { return kind_; }
792 FunctionNode* function() { return function_; } 793 FunctionNode* function() { return function_; }
793 794
794 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; } 795 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; }
795 bool IsAbstract() { return (flags_ & kFlagAbstract) == kFlagAbstract; } 796 bool IsAbstract() { return (flags_ & kFlagAbstract) == kFlagAbstract; }
796 bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; } 797 bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; }
797 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } 798 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; }
798 intptr_t source_uri_index() { return source_uri_index_; } 799 intptr_t source_uri_index() { return source_uri_index_; }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 public: 853 public:
853 static FieldInitializer* ReadFromImpl(Reader* reader); 854 static FieldInitializer* ReadFromImpl(Reader* reader);
854 855
855 virtual ~FieldInitializer(); 856 virtual ~FieldInitializer();
856 857
857 DEFINE_CASTING_OPERATIONS(FieldInitializer); 858 DEFINE_CASTING_OPERATIONS(FieldInitializer);
858 859
859 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); 860 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor);
860 virtual void VisitChildren(Visitor* visitor); 861 virtual void VisitChildren(Visitor* visitor);
861 862
862 CanonicalName* field() { return field_reference_; } 863 Field* field() { return field_reference_->AsField(); }
863 Expression* value() { return value_; } 864 Expression* value() { return value_; }
864 865
865 private: 866 private:
866 FieldInitializer() {} 867 FieldInitializer() {}
867 868
868 Ref<CanonicalName> field_reference_; // Field. 869 Ref<CanonicalName> field_reference_;
869 Child<Expression> value_; 870 Child<Expression> value_;
870 871
871 DISALLOW_COPY_AND_ASSIGN(FieldInitializer); 872 DISALLOW_COPY_AND_ASSIGN(FieldInitializer);
872 }; 873 };
873 874
874 875
875 class SuperInitializer : public Initializer { 876 class SuperInitializer : public Initializer {
876 public: 877 public:
877 static SuperInitializer* ReadFromImpl(Reader* reader); 878 static SuperInitializer* ReadFromImpl(Reader* reader);
878 879
879 virtual ~SuperInitializer(); 880 virtual ~SuperInitializer();
880 881
881 DEFINE_CASTING_OPERATIONS(SuperInitializer); 882 DEFINE_CASTING_OPERATIONS(SuperInitializer);
882 883
883 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); 884 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor);
884 virtual void VisitChildren(Visitor* visitor); 885 virtual void VisitChildren(Visitor* visitor);
885 886
886 CanonicalName* target() { return target_reference_; } 887 Constructor* target() { return target_reference_->AsConstructor(); }
887 Arguments* arguments() { return arguments_; } 888 Arguments* arguments() { return arguments_; }
888 889
889 private: 890 private:
890 SuperInitializer() {} 891 SuperInitializer() {}
891 892
892 Ref<CanonicalName> target_reference_; // Constructor. 893 Ref<CanonicalName> target_reference_;
893 Child<Arguments> arguments_; 894 Child<Arguments> arguments_;
894 895
895 DISALLOW_COPY_AND_ASSIGN(SuperInitializer); 896 DISALLOW_COPY_AND_ASSIGN(SuperInitializer);
896 }; 897 };
897 898
898 899
899 class RedirectingInitializer : public Initializer { 900 class RedirectingInitializer : public Initializer {
900 public: 901 public:
901 static RedirectingInitializer* ReadFromImpl(Reader* reader); 902 static RedirectingInitializer* ReadFromImpl(Reader* reader);
902 903
903 virtual ~RedirectingInitializer(); 904 virtual ~RedirectingInitializer();
904 905
905 DEFINE_CASTING_OPERATIONS(RedirectingInitializer); 906 DEFINE_CASTING_OPERATIONS(RedirectingInitializer);
906 907
907 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); 908 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor);
908 virtual void VisitChildren(Visitor* visitor); 909 virtual void VisitChildren(Visitor* visitor);
909 910
910 CanonicalName* target() { return target_reference_; } 911 Constructor* target() { return target_reference_->AsConstructor(); }
911 Arguments* arguments() { return arguments_; } 912 Arguments* arguments() { return arguments_; }
912 913
913 private: 914 private:
914 RedirectingInitializer() {} 915 RedirectingInitializer() {}
915 916
916 Ref<CanonicalName> target_reference_; // Constructor. 917 Ref<CanonicalName> target_reference_;
917 Child<Arguments> arguments_; 918 Child<Arguments> arguments_;
918 919
919 DISALLOW_COPY_AND_ASSIGN(RedirectingInitializer); 920 DISALLOW_COPY_AND_ASSIGN(RedirectingInitializer);
920 }; 921 };
921 922
922 923
923 class LocalInitializer : public Initializer { 924 class LocalInitializer : public Initializer {
924 public: 925 public:
925 static LocalInitializer* ReadFromImpl(Reader* reader); 926 static LocalInitializer* ReadFromImpl(Reader* reader);
926 927
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 static DirectPropertyGet* ReadFrom(Reader* reader); 1140 static DirectPropertyGet* ReadFrom(Reader* reader);
1140 1141
1141 virtual ~DirectPropertyGet(); 1142 virtual ~DirectPropertyGet();
1142 1143
1143 DEFINE_CASTING_OPERATIONS(DirectPropertyGet); 1144 DEFINE_CASTING_OPERATIONS(DirectPropertyGet);
1144 1145
1145 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); 1146 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
1146 virtual void VisitChildren(Visitor* visitor); 1147 virtual void VisitChildren(Visitor* visitor);
1147 1148
1148 Expression* receiver() { return receiver_; } 1149 Expression* receiver() { return receiver_; }
1149 CanonicalName* target() { return target_reference_; } 1150 Member* target() { return target_reference_->AsMember(); }
1150 1151
1151 private: 1152 private:
1152 DirectPropertyGet() {} 1153 DirectPropertyGet() {}
1153 1154
1154 Child<Expression> receiver_; 1155 Child<Expression> receiver_;
1155 Ref<CanonicalName> target_reference_; // Member. 1156 Ref<CanonicalName> target_reference_;
1156 1157
1157 DISALLOW_COPY_AND_ASSIGN(DirectPropertyGet); 1158 DISALLOW_COPY_AND_ASSIGN(DirectPropertyGet);
1158 }; 1159 };
1159 1160
1160 1161
1161 class DirectPropertySet : public Expression { 1162 class DirectPropertySet : public Expression {
1162 public: 1163 public:
1163 static DirectPropertySet* ReadFrom(Reader* reader); 1164 static DirectPropertySet* ReadFrom(Reader* reader);
1164 1165
1165 virtual ~DirectPropertySet(); 1166 virtual ~DirectPropertySet();
1166 1167
1167 DEFINE_CASTING_OPERATIONS(DirectPropertySet); 1168 DEFINE_CASTING_OPERATIONS(DirectPropertySet);
1168 1169
1169 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); 1170 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
1170 virtual void VisitChildren(Visitor* visitor); 1171 virtual void VisitChildren(Visitor* visitor);
1171 1172
1172 Expression* receiver() { return receiver_; } 1173 Expression* receiver() { return receiver_; }
1173 CanonicalName* target() { return target_reference_; } 1174 Member* target() { return target_reference_->AsMember(); }
1174 Expression* value() { return value_; } 1175 Expression* value() { return value_; }
1175 1176
1176 private: 1177 private:
1177 DirectPropertySet() {} 1178 DirectPropertySet() {}
1178 1179
1179 Child<Expression> receiver_; 1180 Child<Expression> receiver_;
1180 Ref<CanonicalName> target_reference_; // Member. 1181 Ref<CanonicalName> target_reference_;
1181 Child<Expression> value_; 1182 Child<Expression> value_;
1182 1183
1183 DISALLOW_COPY_AND_ASSIGN(DirectPropertySet); 1184 DISALLOW_COPY_AND_ASSIGN(DirectPropertySet);
1184 }; 1185 };
1185 1186
1186 1187
1187 class StaticGet : public Expression { 1188 class StaticGet : public Expression {
1188 public: 1189 public:
1189 static StaticGet* ReadFrom(Reader* reader); 1190 static StaticGet* ReadFrom(Reader* reader);
1190 1191
1191 virtual ~StaticGet(); 1192 virtual ~StaticGet();
1192 1193
1193 DEFINE_CASTING_OPERATIONS(StaticGet); 1194 DEFINE_CASTING_OPERATIONS(StaticGet);
1194 1195
1195 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); 1196 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
1196 virtual void VisitChildren(Visitor* visitor); 1197 virtual void VisitChildren(Visitor* visitor);
1197 1198
1198 CanonicalName* target() { return target_reference_; } 1199 Member* target() { return target_reference_->AsMember(); }
1199 1200
1200 private: 1201 private:
1201 StaticGet() {} 1202 StaticGet() {}
1202 1203
1203 Ref<CanonicalName> target_reference_; // Member. 1204 Ref<CanonicalName> target_reference_;
1204 1205
1205 DISALLOW_COPY_AND_ASSIGN(StaticGet); 1206 DISALLOW_COPY_AND_ASSIGN(StaticGet);
1206 }; 1207 };
1207 1208
1208 1209
1209 class StaticSet : public Expression { 1210 class StaticSet : public Expression {
1210 public: 1211 public:
1211 static StaticSet* ReadFrom(Reader* reader); 1212 static StaticSet* ReadFrom(Reader* reader);
1212 1213
1213 virtual ~StaticSet(); 1214 virtual ~StaticSet();
1214 1215
1215 DEFINE_CASTING_OPERATIONS(StaticSet); 1216 DEFINE_CASTING_OPERATIONS(StaticSet);
1216 1217
1217 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); 1218 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
1218 virtual void VisitChildren(Visitor* visitor); 1219 virtual void VisitChildren(Visitor* visitor);
1219 1220
1220 CanonicalName* target() { return target_reference_; } 1221 Member* target() { return target_reference_->AsMember(); }
1221 Expression* expression() { return expression_; } 1222 Expression* expression() { return expression_; }
1222 1223
1223 private: 1224 private:
1224 StaticSet() {} 1225 StaticSet() {}
1225 1226
1226 Ref<CanonicalName> target_reference_; // Member. 1227 Ref<CanonicalName> target_reference_;
1227 Child<Expression> expression_; 1228 Child<Expression> expression_;
1228 1229
1229 DISALLOW_COPY_AND_ASSIGN(StaticSet); 1230 DISALLOW_COPY_AND_ASSIGN(StaticSet);
1230 }; 1231 };
1231 1232
1232 1233
1233 class Arguments : public TreeNode { 1234 class Arguments : public TreeNode {
1234 public: 1235 public:
1235 static Arguments* ReadFrom(Reader* reader); 1236 static Arguments* ReadFrom(Reader* reader);
1236 1237
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 static DirectMethodInvocation* ReadFrom(Reader* reader); 1317 static DirectMethodInvocation* ReadFrom(Reader* reader);
1317 1318
1318 virtual ~DirectMethodInvocation(); 1319 virtual ~DirectMethodInvocation();
1319 1320
1320 DEFINE_CASTING_OPERATIONS(DirectMethodInvocation); 1321 DEFINE_CASTING_OPERATIONS(DirectMethodInvocation);
1321 1322
1322 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); 1323 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
1323 virtual void VisitChildren(Visitor* visitor); 1324 virtual void VisitChildren(Visitor* visitor);
1324 1325
1325 Expression* receiver() { return receiver_; } 1326 Expression* receiver() { return receiver_; }
1326 CanonicalName* target() { return target_reference_; } 1327 Procedure* target() { return target_reference_->AsProcedure(); }
1327 Arguments* arguments() { return arguments_; } 1328 Arguments* arguments() { return arguments_; }
1328 1329
1329 private: 1330 private:
1330 DirectMethodInvocation() {} 1331 DirectMethodInvocation() {}
1331 1332
1332 Child<Expression> receiver_; 1333 Child<Expression> receiver_;
1333 Ref<CanonicalName> target_reference_; // Procedure. 1334 Ref<CanonicalName> target_reference_;
1334 Child<Arguments> arguments_; 1335 Child<Arguments> arguments_;
1335 1336
1336 DISALLOW_COPY_AND_ASSIGN(DirectMethodInvocation); 1337 DISALLOW_COPY_AND_ASSIGN(DirectMethodInvocation);
1337 }; 1338 };
1338 1339
1339 1340
1340 class StaticInvocation : public Expression { 1341 class StaticInvocation : public Expression {
1341 public: 1342 public:
1342 static StaticInvocation* ReadFrom(Reader* reader, bool is_const); 1343 static StaticInvocation* ReadFrom(Reader* reader, bool is_const);
1343 ~StaticInvocation(); 1344 ~StaticInvocation();
1344 1345
1345 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); 1346 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
1346 virtual void VisitChildren(Visitor* visitor); 1347 virtual void VisitChildren(Visitor* visitor);
1347 1348
1348 CanonicalName* procedure() { return procedure_reference_; } 1349 Procedure* procedure() { return procedure_reference_->AsProcedure(); }
1349 Arguments* arguments() { return arguments_; } 1350 Arguments* arguments() { return arguments_; }
1350 bool is_const() { return is_const_; } 1351 bool is_const() { return is_const_; }
1351 1352
1352 private: 1353 private:
1353 StaticInvocation() {} 1354 StaticInvocation() {}
1354 1355
1355 Ref<CanonicalName> procedure_reference_; // Procedure. 1356 Ref<CanonicalName> procedure_reference_;
1356 Child<Arguments> arguments_; 1357 Child<Arguments> arguments_;
1357 bool is_const_; 1358 bool is_const_;
1358 1359
1359 DISALLOW_COPY_AND_ASSIGN(StaticInvocation); 1360 DISALLOW_COPY_AND_ASSIGN(StaticInvocation);
1360 }; 1361 };
1361 1362
1362 1363
1363 class ConstructorInvocation : public Expression { 1364 class ConstructorInvocation : public Expression {
1364 public: 1365 public:
1365 static ConstructorInvocation* ReadFrom(Reader* reader, bool is_const); 1366 static ConstructorInvocation* ReadFrom(Reader* reader, bool is_const);
1366 1367
1367 virtual ~ConstructorInvocation(); 1368 virtual ~ConstructorInvocation();
1368 1369
1369 DEFINE_CASTING_OPERATIONS(ConstructorInvocation); 1370 DEFINE_CASTING_OPERATIONS(ConstructorInvocation);
1370 1371
1371 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); 1372 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
1372 virtual void VisitChildren(Visitor* visitor); 1373 virtual void VisitChildren(Visitor* visitor);
1373 1374
1374 bool is_const() { return is_const_; } 1375 bool is_const() { return is_const_; }
1375 CanonicalName* target() { return target_reference_; } 1376 Constructor* target() { return target_reference_->AsConstructor(); }
1376 Arguments* arguments() { return arguments_; } 1377 Arguments* arguments() { return arguments_; }
1377 1378
1378 private: 1379 private:
1379 ConstructorInvocation() {} 1380 ConstructorInvocation() {}
1380 1381
1381 bool is_const_; 1382 bool is_const_;
1382 Ref<CanonicalName> target_reference_; // Constructor. 1383 Ref<CanonicalName> target_reference_;
1383 Child<Arguments> arguments_; 1384 Child<Arguments> arguments_;
1384 1385
1385 DISALLOW_COPY_AND_ASSIGN(ConstructorInvocation); 1386 DISALLOW_COPY_AND_ASSIGN(ConstructorInvocation);
1386 }; 1387 };
1387 1388
1388 1389
1389 class Not : public Expression { 1390 class Not : public Expression {
1390 public: 1391 public:
1391 static Not* ReadFrom(Reader* reader); 1392 static Not* ReadFrom(Reader* reader);
1392 1393
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 static Name* ReadFrom(Reader* reader); 2522 static Name* ReadFrom(Reader* reader);
2522 2523
2523 virtual ~Name(); 2524 virtual ~Name();
2524 2525
2525 DEFINE_CASTING_OPERATIONS(Name); 2526 DEFINE_CASTING_OPERATIONS(Name);
2526 2527
2527 virtual void AcceptVisitor(Visitor* visitor); 2528 virtual void AcceptVisitor(Visitor* visitor);
2528 virtual void VisitChildren(Visitor* visitor); 2529 virtual void VisitChildren(Visitor* visitor);
2529 2530
2530 String* string() { return string_; } 2531 String* string() { return string_; }
2531 CanonicalName* library() { return library_reference_; } 2532 Library* library() {
2533 if (library_reference_ == NULL) return NULL;
2534 return library_reference_->AsLibrary();
2535 }
2536 CanonicalName* library_reference() { return library_reference_; }
2532 2537
2533 private: 2538 private:
2534 Name(String* string, CanonicalName* library_reference) 2539 Name(String* string, CanonicalName* library_reference)
2535 : string_(string), library_reference_(library_reference) {} // NOLINT 2540 : string_(string), library_reference_(library_reference) {} // NOLINT
2536 2541
2537 Ref<String> string_; 2542 Ref<String> string_;
2538 Ref<CanonicalName> library_reference_; // Library. 2543 Ref<CanonicalName> library_reference_;
2539 2544
2540 DISALLOW_COPY_AND_ASSIGN(Name); 2545 DISALLOW_COPY_AND_ASSIGN(Name);
2541 }; 2546 };
2542 2547
2543 2548
2544 class DartType : public Node { 2549 class DartType : public Node {
2545 public: 2550 public:
2546 static DartType* ReadFrom(Reader* reader); 2551 static DartType* ReadFrom(Reader* reader);
2547 2552
2548 virtual ~DartType(); 2553 virtual ~DartType();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 2626
2622 explicit InterfaceType(CanonicalName* class_reference) 2627 explicit InterfaceType(CanonicalName* class_reference)
2623 : class_reference_(class_reference) {} 2628 : class_reference_(class_reference) {}
2624 virtual ~InterfaceType(); 2629 virtual ~InterfaceType();
2625 2630
2626 DEFINE_CASTING_OPERATIONS(InterfaceType); 2631 DEFINE_CASTING_OPERATIONS(InterfaceType);
2627 2632
2628 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); 2633 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor);
2629 virtual void VisitChildren(Visitor* visitor); 2634 virtual void VisitChildren(Visitor* visitor);
2630 2635
2631 CanonicalName* klass() { return class_reference_; } 2636 Class* klass() { return class_reference_->AsClass(); }
2637 CanonicalName* class_reference() { return class_reference_; }
2632 List<DartType>& type_arguments() { return type_arguments_; } 2638 List<DartType>& type_arguments() { return type_arguments_; }
2633 2639
2634 private: 2640 private:
2635 InterfaceType() {} 2641 InterfaceType() {}
2636 2642
2637 Ref<CanonicalName> class_reference_; // Class. 2643 Ref<CanonicalName> class_reference_;
2638 List<DartType> type_arguments_; 2644 List<DartType> type_arguments_;
2639 2645
2640 DISALLOW_COPY_AND_ASSIGN(InterfaceType); 2646 DISALLOW_COPY_AND_ASSIGN(InterfaceType);
2641 }; 2647 };
2642 2648
2643 2649
2644 class FunctionType : public DartType { 2650 class FunctionType : public DartType {
2645 public: 2651 public:
2646 static FunctionType* ReadFrom(Reader* reader); 2652 static FunctionType* ReadFrom(Reader* reader);
2647 static FunctionType* ReadFrom(Reader* reader, bool _without_type_arguments_); 2653 static FunctionType* ReadFrom(Reader* reader, bool _without_type_arguments_);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 2738
2733 DEFINE_CASTING_OPERATIONS(Program); 2739 DEFINE_CASTING_OPERATIONS(Program);
2734 2740
2735 virtual void AcceptTreeVisitor(TreeVisitor* visitor); 2741 virtual void AcceptTreeVisitor(TreeVisitor* visitor);
2736 virtual void VisitChildren(Visitor* visitor); 2742 virtual void VisitChildren(Visitor* visitor);
2737 2743
2738 StringTable& string_table() { return string_table_; } 2744 StringTable& string_table() { return string_table_; }
2739 StringTable& source_uri_table() { return source_uri_table_; } 2745 StringTable& source_uri_table() { return source_uri_table_; }
2740 SourceTable& source_table() { return source_table_; } 2746 SourceTable& source_table() { return source_table_; }
2741 List<Library>& libraries() { return libraries_; } 2747 List<Library>& libraries() { return libraries_; }
2742 CanonicalName* main_method() { return main_method_reference_; } 2748 Procedure* main_method() {
2749 if (main_method_reference_ == NULL) return NULL;
2750 return main_method_reference_->AsProcedure();
2751 }
2743 CanonicalName* canonical_name_root() { return canonical_name_root_; } 2752 CanonicalName* canonical_name_root() { return canonical_name_root_; }
2744 MallocGrowableArray<MallocGrowableArray<intptr_t>*> valid_token_positions; 2753 MallocGrowableArray<MallocGrowableArray<intptr_t>*> valid_token_positions;
2745 MallocGrowableArray<MallocGrowableArray<intptr_t>*> yield_token_positions; 2754 MallocGrowableArray<MallocGrowableArray<intptr_t>*> yield_token_positions;
2746 2755
2747 private: 2756 private:
2748 Program() {} 2757 Program() {}
2749 2758
2750 Child<CanonicalName> canonical_name_root_; 2759 Child<CanonicalName> canonical_name_root_;
2751 List<Library> libraries_; 2760 List<Library> libraries_;
2752 Ref<CanonicalName> main_method_reference_; // Procedure. 2761 Ref<CanonicalName> main_method_reference_;
2753 StringTable string_table_; 2762 StringTable string_table_;
2754 StringTable source_uri_table_; 2763 StringTable source_uri_table_;
2755 SourceTable source_table_; 2764 SourceTable source_table_;
2756 2765
2757 DISALLOW_COPY_AND_ASSIGN(Program); 2766 DISALLOW_COPY_AND_ASSIGN(Program);
2758 }; 2767 };
2759 2768
2760 2769
2761 class Reference : public AllStatic { 2770 class Reference : public AllStatic {
2762 public: 2771 public:
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 } 3006 }
2998 virtual void VisitFunctionType(FunctionType* node) { 3007 virtual void VisitFunctionType(FunctionType* node) {
2999 VisitDefaultDartType(node); 3008 VisitDefaultDartType(node);
3000 } 3009 }
3001 virtual void VisitTypeParameterType(TypeParameterType* node) { 3010 virtual void VisitTypeParameterType(TypeParameterType* node) {
3002 VisitDefaultDartType(node); 3011 VisitDefaultDartType(node);
3003 } 3012 }
3004 }; 3013 };
3005 3014
3006 3015
3016 class ClassReferenceVisitor {
3017 public:
3018 virtual ~ClassReferenceVisitor() {}
3019
3020 virtual void VisitDefaultClassReference(Class* node) = 0;
3021 virtual void VisitNormalClassReference(NormalClass* node) {
3022 VisitDefaultClassReference(node);
3023 }
3024 virtual void VisitMixinClassReference(MixinClass* node) {
3025 VisitDefaultClassReference(node);
3026 }
3027 };
3028
3029
3030 class MemberReferenceVisitor {
3031 public:
3032 virtual ~MemberReferenceVisitor() {}
3033
3034 virtual void VisitDefaultMemberReference(Member* node) = 0;
3035 virtual void VisitFieldReference(Field* node) {
3036 VisitDefaultMemberReference(node);
3037 }
3038 virtual void VisitConstructorReference(Constructor* node) {
3039 VisitDefaultMemberReference(node);
3040 }
3041 virtual void VisitProcedureReference(Procedure* node) {
3042 VisitDefaultMemberReference(node);
3043 }
3044 };
3045
3046
3007 class TreeVisitor : public ExpressionVisitor, 3047 class TreeVisitor : public ExpressionVisitor,
3008 public StatementVisitor, 3048 public StatementVisitor,
3009 public MemberVisitor, 3049 public MemberVisitor,
3010 public ClassVisitor, 3050 public ClassVisitor,
3011 public InitializerVisitor { 3051 public InitializerVisitor {
3012 public: 3052 public:
3013 virtual ~TreeVisitor() {} 3053 virtual ~TreeVisitor() {}
3014 3054
3015 virtual void VisitDefaultTreeNode(TreeNode* node) = 0; 3055 virtual void VisitDefaultTreeNode(TreeNode* node) = 0;
3016 virtual void VisitDefaultStatement(Statement* node) { 3056 virtual void VisitDefaultStatement(Statement* node) {
(...skipping 19 matching lines...) Expand all
3036 virtual void VisitNamedExpression(NamedExpression* node) { 3076 virtual void VisitNamedExpression(NamedExpression* node) {
3037 VisitDefaultTreeNode(node); 3077 VisitDefaultTreeNode(node);
3038 } 3078 }
3039 virtual void VisitSwitchCase(SwitchCase* node) { VisitDefaultTreeNode(node); } 3079 virtual void VisitSwitchCase(SwitchCase* node) { VisitDefaultTreeNode(node); }
3040 virtual void VisitCatch(Catch* node) { VisitDefaultTreeNode(node); } 3080 virtual void VisitCatch(Catch* node) { VisitDefaultTreeNode(node); }
3041 virtual void VisitMapEntry(MapEntry* node) { VisitDefaultTreeNode(node); } 3081 virtual void VisitMapEntry(MapEntry* node) { VisitDefaultTreeNode(node); }
3042 virtual void VisitProgram(Program* node) { VisitDefaultTreeNode(node); } 3082 virtual void VisitProgram(Program* node) { VisitDefaultTreeNode(node); }
3043 }; 3083 };
3044 3084
3045 3085
3046 class Visitor : public TreeVisitor, public DartTypeVisitor { 3086 class Visitor : public TreeVisitor,
3087 public DartTypeVisitor,
3088 public ClassReferenceVisitor,
3089 public MemberReferenceVisitor {
3047 public: 3090 public:
3048 virtual ~Visitor() {} 3091 virtual ~Visitor() {}
3049 3092
3050 virtual void VisitDefaultNode(Node* node) = 0; 3093 virtual void VisitDefaultNode(Node* node) = 0;
3051 virtual void VisitDefaultTreeNode(TreeNode* node) { VisitDefaultNode(node); } 3094 virtual void VisitDefaultTreeNode(TreeNode* node) { VisitDefaultNode(node); }
3052 virtual void VisitDefaultDartType(DartType* node) { VisitDefaultNode(node); } 3095 virtual void VisitDefaultDartType(DartType* node) { VisitDefaultNode(node); }
3053 virtual void VisitName(Name* node) { VisitDefaultNode(node); } 3096 virtual void VisitName(Name* node) { VisitDefaultNode(node); }
3054 virtual void VisitDefaultClassReference(Class* node) { 3097 virtual void VisitDefaultClassReference(Class* node) {
3055 VisitDefaultNode(node); 3098 VisitDefaultNode(node);
3056 } 3099 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 3187
3145 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, 3188 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer,
3146 intptr_t buffer_length); 3189 intptr_t buffer_length);
3147 3190
3148 3191
3149 3192
3150 } // namespace dart 3193 } // namespace dart
3151 3194
3152 #endif // !defined(DART_PRECOMPILED_RUNTIME) 3195 #endif // !defined(DART_PRECOMPILED_RUNTIME)
3153 #endif // RUNTIME_VM_KERNEL_H_ 3196 #endif // RUNTIME_VM_KERNEL_H_
OLDNEW
« no previous file with comments | « pkg/kernel/lib/canonical_name.dart ('k') | runtime/vm/kernel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698