OLD | NEW |
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 M(Program) | 115 M(Program) |
116 | 116 |
117 #define KERNEL_ALL_NODES_DO(M) \ | 117 #define KERNEL_ALL_NODES_DO(M) \ |
118 M(Node) \ | 118 M(Node) \ |
119 KERNEL_NODES_DO(M) \ | 119 KERNEL_NODES_DO(M) \ |
120 M(TreeNode) \ | 120 M(TreeNode) \ |
121 KERNEL_TREE_NODES_DO(M) | 121 KERNEL_TREE_NODES_DO(M) |
122 | 122 |
123 #define KERNEL_VISITORS_DO(M) \ | 123 #define KERNEL_VISITORS_DO(M) \ |
124 M(ExpressionVisitor) \ | 124 M(ExpressionVisitor) \ |
125 M(StatementVisitor) \ | |
126 M(MemberVisitor) \ | |
127 M(ClassVisitor) \ | |
128 M(InitializerVisitor) \ | |
129 M(DartTypeVisitor) \ | 125 M(DartTypeVisitor) \ |
130 M(TreeVisitor) \ | |
131 M(Visitor) | |
132 | 126 |
133 namespace dart { | 127 namespace dart { |
134 | 128 |
135 class Field; | 129 class Field; |
136 class ParsedFunction; | 130 class ParsedFunction; |
137 class Zone; | 131 class Zone; |
138 | 132 |
139 namespace kernel { | 133 namespace kernel { |
140 | 134 |
141 | 135 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 #define DO(name) kType##name, | 363 #define DO(name) kType##name, |
370 KERNEL_ALL_NODES_DO(DO) | 364 KERNEL_ALL_NODES_DO(DO) |
371 #undef DO | 365 #undef DO |
372 | 366 |
373 kNumTypes | 367 kNumTypes |
374 }; | 368 }; |
375 | 369 |
376 DEFINE_ALL_IS_OPERATIONS(); | 370 DEFINE_ALL_IS_OPERATIONS(); |
377 DEFINE_CASTING_OPERATIONS(Node); | 371 DEFINE_CASTING_OPERATIONS(Node); |
378 | 372 |
379 virtual void AcceptVisitor(Visitor* visitor) = 0; | |
380 virtual void VisitChildren(Visitor* visitor) = 0; | |
381 | |
382 protected: | 373 protected: |
383 Node() {} | 374 Node() {} |
384 | 375 |
385 private: | 376 private: |
386 DISALLOW_COPY_AND_ASSIGN(Node); | 377 DISALLOW_COPY_AND_ASSIGN(Node); |
387 }; | 378 }; |
388 | 379 |
389 | 380 |
390 class TreeNode : public Node { | 381 class TreeNode : public Node { |
391 public: | 382 public: |
392 virtual ~TreeNode(); | 383 virtual ~TreeNode(); |
393 | 384 |
394 DEFINE_CASTING_OPERATIONS(TreeNode); | 385 DEFINE_CASTING_OPERATIONS(TreeNode); |
395 | 386 |
396 virtual void AcceptVisitor(Visitor* visitor); | |
397 virtual void AcceptTreeVisitor(TreeVisitor* visitor) = 0; | |
398 intptr_t kernel_offset() const { | 387 intptr_t kernel_offset() const { |
399 ASSERT(kernel_offset_ > 0); | 388 ASSERT(kernel_offset_ > 0); |
400 return kernel_offset_; | 389 return kernel_offset_; |
401 } | 390 } |
402 bool can_stream() { return can_stream_; } | |
403 | 391 |
404 protected: | 392 protected: |
405 TreeNode() : kernel_offset_(-1), can_stream_(true) {} | 393 TreeNode() : kernel_offset_(-1) {} |
406 | 394 |
407 // Offset for this node in the kernel-binary. If this node has a tag the | 395 // Offset for this node in the kernel-binary. If this node has a tag the |
408 // offset includes the tag. Can be -1 to indicate "unknown" or invalid offset. | 396 // offset includes the tag. Can be -1 to indicate "unknown" or invalid offset. |
409 intptr_t kernel_offset_; | 397 intptr_t kernel_offset_; |
410 | 398 |
411 bool can_stream_; | |
412 | |
413 private: | 399 private: |
414 DISALLOW_COPY_AND_ASSIGN(TreeNode); | 400 DISALLOW_COPY_AND_ASSIGN(TreeNode); |
415 }; | 401 }; |
416 | 402 |
417 | 403 |
418 class LinkedNode : public TreeNode { | 404 class LinkedNode : public TreeNode { |
419 public: | 405 public: |
420 virtual ~LinkedNode(); | 406 virtual ~LinkedNode(); |
421 | 407 |
422 NameIndex canonical_name() { return canonical_name_; } | 408 NameIndex canonical_name() { return canonical_name_; } |
423 | 409 |
424 protected: | 410 protected: |
425 LinkedNode() {} | 411 LinkedNode() {} |
426 | 412 |
427 NameIndex canonical_name_; | 413 NameIndex canonical_name_; |
428 | 414 |
429 private: | 415 private: |
430 DISALLOW_COPY_AND_ASSIGN(LinkedNode); | 416 DISALLOW_COPY_AND_ASSIGN(LinkedNode); |
431 }; | 417 }; |
432 | 418 |
433 | 419 |
434 class Library : public LinkedNode { | 420 class Library : public LinkedNode { |
435 public: | 421 public: |
436 Library* ReadFrom(Reader* reader); | 422 Library* ReadFrom(Reader* reader); |
437 | 423 |
438 virtual ~Library(); | 424 virtual ~Library(); |
439 | 425 |
440 DEFINE_CASTING_OPERATIONS(Library); | 426 DEFINE_CASTING_OPERATIONS(Library); |
441 | 427 |
442 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
443 virtual void VisitChildren(Visitor* visitor); | |
444 | |
445 StringIndex import_uri() { return import_uri_index_; } | 428 StringIndex import_uri() { return import_uri_index_; } |
446 intptr_t source_uri_index() { return source_uri_index_; } | 429 intptr_t source_uri_index() { return source_uri_index_; } |
447 StringIndex name() { return name_index_; } | 430 StringIndex name() { return name_index_; } |
448 List<Typedef>& typedefs() { return typedefs_; } | 431 List<Typedef>& typedefs() { return typedefs_; } |
449 List<Class>& classes() { return classes_; } | 432 List<Class>& classes() { return classes_; } |
450 List<Field>& fields() { return fields_; } | 433 List<Field>& fields() { return fields_; } |
451 List<Procedure>& procedures() { return procedures_; } | 434 List<Procedure>& procedures() { return procedures_; } |
452 | 435 |
453 const uint8_t* kernel_data() { return kernel_data_; } | 436 const uint8_t* kernel_data() { return kernel_data_; } |
454 intptr_t kernel_data_size() { return kernel_data_size_; } | 437 intptr_t kernel_data_size() { return kernel_data_size_; } |
(...skipping 19 matching lines...) Expand all Loading... |
474 | 457 |
475 | 458 |
476 class Typedef : public LinkedNode { | 459 class Typedef : public LinkedNode { |
477 public: | 460 public: |
478 Typedef* ReadFrom(Reader* reader); | 461 Typedef* ReadFrom(Reader* reader); |
479 | 462 |
480 virtual ~Typedef(); | 463 virtual ~Typedef(); |
481 | 464 |
482 DEFINE_CASTING_OPERATIONS(Typedef); | 465 DEFINE_CASTING_OPERATIONS(Typedef); |
483 | 466 |
484 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
485 virtual void VisitChildren(Visitor* visitor); | |
486 | |
487 Library* parent() { return parent_; } | 467 Library* parent() { return parent_; } |
488 StringIndex name() { return name_index_; } | 468 StringIndex name() { return name_index_; } |
489 intptr_t source_uri_index() { return source_uri_index_; } | 469 intptr_t source_uri_index() { return source_uri_index_; } |
490 TokenPosition position() { return position_; } | 470 TokenPosition position() { return position_; } |
491 TypeParameterList& type_parameters() { return type_parameters_; } | 471 TypeParameterList& type_parameters() { return type_parameters_; } |
492 DartType* type() { return type_; } | 472 DartType* type() { return type_; } |
493 | 473 |
494 protected: | 474 protected: |
495 Typedef() : position_(TokenPosition::kNoSource) {} | 475 Typedef() : position_(TokenPosition::kNoSource) {} |
496 | 476 |
(...skipping 11 matching lines...) Expand all Loading... |
508 | 488 |
509 | 489 |
510 class Class : public LinkedNode { | 490 class Class : public LinkedNode { |
511 public: | 491 public: |
512 Class* ReadFrom(Reader* reader); | 492 Class* ReadFrom(Reader* reader); |
513 | 493 |
514 virtual ~Class(); | 494 virtual ~Class(); |
515 | 495 |
516 DEFINE_CASTING_OPERATIONS(Class); | 496 DEFINE_CASTING_OPERATIONS(Class); |
517 | 497 |
518 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
519 virtual void AcceptClassVisitor(ClassVisitor* visitor) = 0; | |
520 | |
521 Library* parent() { return parent_; } | 498 Library* parent() { return parent_; } |
522 StringIndex name() { return name_index_; } | 499 StringIndex name() { return name_index_; } |
523 intptr_t source_uri_index() { return source_uri_index_; } | 500 intptr_t source_uri_index() { return source_uri_index_; } |
524 bool is_abstract() { return is_abstract_; } | 501 bool is_abstract() { return is_abstract_; } |
525 List<Expression>& annotations() { return annotations_; } | 502 List<Expression>& annotations() { return annotations_; } |
526 TokenPosition position() { return position_; } | 503 TokenPosition position() { return position_; } |
527 | 504 |
528 virtual List<TypeParameter>& type_parameters() = 0; | 505 virtual List<TypeParameter>& type_parameters() = 0; |
529 virtual List<InterfaceType>& implemented_classes() = 0; | 506 virtual List<InterfaceType>& implemented_classes() = 0; |
530 virtual List<Field>& fields() = 0; | 507 virtual List<Field>& fields() = 0; |
(...skipping 19 matching lines...) Expand all Loading... |
550 | 527 |
551 | 528 |
552 class NormalClass : public Class { | 529 class NormalClass : public Class { |
553 public: | 530 public: |
554 NormalClass* ReadFrom(Reader* reader); | 531 NormalClass* ReadFrom(Reader* reader); |
555 | 532 |
556 virtual ~NormalClass(); | 533 virtual ~NormalClass(); |
557 | 534 |
558 DEFINE_CASTING_OPERATIONS(NormalClass); | 535 DEFINE_CASTING_OPERATIONS(NormalClass); |
559 | 536 |
560 virtual void AcceptClassVisitor(ClassVisitor* visitor); | |
561 virtual void VisitChildren(Visitor* visitor); | |
562 | |
563 virtual TypeParameterList& type_parameters() { return type_parameters_; } | 537 virtual TypeParameterList& type_parameters() { return type_parameters_; } |
564 InterfaceType* super_class() { return super_class_; } | 538 InterfaceType* super_class() { return super_class_; } |
565 virtual List<InterfaceType>& implemented_classes() { | 539 virtual List<InterfaceType>& implemented_classes() { |
566 return implemented_classes_; | 540 return implemented_classes_; |
567 } | 541 } |
568 virtual List<Constructor>& constructors() { return constructors_; } | 542 virtual List<Constructor>& constructors() { return constructors_; } |
569 virtual List<Procedure>& procedures() { return procedures_; } | 543 virtual List<Procedure>& procedures() { return procedures_; } |
570 virtual List<Field>& fields() { return fields_; } | 544 virtual List<Field>& fields() { return fields_; } |
571 | 545 |
572 private: | 546 private: |
573 NormalClass() {} | 547 NormalClass() {} |
574 | 548 |
575 template <typename T> | 549 template <typename T> |
576 friend class List; | 550 friend class List; |
577 | 551 |
578 TypeParameterList type_parameters_; | 552 TypeParameterList type_parameters_; |
579 Child<InterfaceType> super_class_; | 553 Child<InterfaceType> super_class_; |
580 List<InterfaceType> implemented_classes_; | 554 List<InterfaceType> implemented_classes_; |
581 List<Constructor> constructors_; | 555 List<Constructor> constructors_; |
582 List<Procedure> procedures_; | 556 List<Procedure> procedures_; |
583 List<Field> fields_; | 557 List<Field> fields_; |
584 | 558 |
585 DISALLOW_COPY_AND_ASSIGN(NormalClass); | 559 DISALLOW_COPY_AND_ASSIGN(NormalClass); |
586 }; | 560 }; |
587 | 561 |
588 | 562 |
589 class MixinClass : public Class { | |
590 public: | |
591 MixinClass* ReadFrom(Reader* reader); | |
592 | |
593 virtual ~MixinClass(); | |
594 | |
595 DEFINE_CASTING_OPERATIONS(MixinClass); | |
596 | |
597 virtual void AcceptClassVisitor(ClassVisitor* visitor); | |
598 virtual void VisitChildren(Visitor* visitor); | |
599 | |
600 virtual TypeParameterList& type_parameters() { return type_parameters_; } | |
601 InterfaceType* first() { return first_; } | |
602 InterfaceType* second() { return second_; } | |
603 virtual List<InterfaceType>& implemented_classes() { | |
604 return implemented_classes_; | |
605 } | |
606 virtual List<Constructor>& constructors() { return constructors_; } | |
607 virtual List<Field>& fields() { return fields_; } | |
608 virtual List<Procedure>& procedures() { return procedures_; } | |
609 | |
610 private: | |
611 MixinClass() {} | |
612 | |
613 template <typename T> | |
614 friend class List; | |
615 | |
616 TypeParameterList type_parameters_; | |
617 Child<InterfaceType> first_; | |
618 Child<InterfaceType> second_; | |
619 List<InterfaceType> implemented_classes_; | |
620 List<Constructor> constructors_; | |
621 | |
622 // Dummy instances which are empty lists. | |
623 List<Field> fields_; | |
624 List<Procedure> procedures_; | |
625 | |
626 DISALLOW_COPY_AND_ASSIGN(MixinClass); | |
627 }; | |
628 | |
629 | |
630 class Member : public LinkedNode { | 563 class Member : public LinkedNode { |
631 public: | 564 public: |
632 virtual ~Member(); | 565 virtual ~Member(); |
633 | 566 |
634 DEFINE_CASTING_OPERATIONS(Member); | 567 DEFINE_CASTING_OPERATIONS(Member); |
635 | 568 |
636 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
637 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0; | |
638 | |
639 TreeNode* parent() { return parent_; } | 569 TreeNode* parent() { return parent_; } |
640 Name* name() { return name_; } | 570 Name* name() { return name_; } |
641 List<Expression>& annotations() { return annotations_; } | 571 List<Expression>& annotations() { return annotations_; } |
642 TokenPosition position() { return position_; } | 572 TokenPosition position() { return position_; } |
643 TokenPosition end_position() { return end_position_; } | 573 TokenPosition end_position() { return end_position_; } |
644 | 574 |
645 protected: | 575 protected: |
646 Member() | 576 Member() |
647 : position_(TokenPosition::kNoSource), | 577 : position_(TokenPosition::kNoSource), |
648 end_position_(TokenPosition::kNoSource) {} | 578 end_position_(TokenPosition::kNoSource) {} |
(...skipping 19 matching lines...) Expand all Loading... |
668 kFlagConst = 1 << 1, | 598 kFlagConst = 1 << 1, |
669 kFlagStatic = 1 << 2, | 599 kFlagStatic = 1 << 2, |
670 }; | 600 }; |
671 | 601 |
672 Field* ReadFrom(Reader* reader); | 602 Field* ReadFrom(Reader* reader); |
673 | 603 |
674 virtual ~Field(); | 604 virtual ~Field(); |
675 | 605 |
676 DEFINE_CASTING_OPERATIONS(Field); | 606 DEFINE_CASTING_OPERATIONS(Field); |
677 | 607 |
678 virtual void AcceptMemberVisitor(MemberVisitor* visitor); | |
679 virtual void VisitChildren(Visitor* visitor); | |
680 | |
681 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } | 608 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } |
682 bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; } | 609 bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; } |
683 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; } | 610 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; } |
684 intptr_t source_uri_index() { return source_uri_index_; } | 611 intptr_t source_uri_index() { return source_uri_index_; } |
685 | 612 |
686 DartType* type() { return type_; } | 613 DartType* type() { return type_; } |
687 Expression* initializer() { return initializer_; } | 614 Expression* initializer() { return initializer_; } |
688 | 615 |
689 private: | 616 private: |
690 Field() {} | 617 Field() {} |
(...skipping 16 matching lines...) Expand all Loading... |
707 kFlagConst = 1 << 0, | 634 kFlagConst = 1 << 0, |
708 kFlagExternal = 1 << 1, | 635 kFlagExternal = 1 << 1, |
709 }; | 636 }; |
710 | 637 |
711 Constructor* ReadFrom(Reader* reader); | 638 Constructor* ReadFrom(Reader* reader); |
712 | 639 |
713 virtual ~Constructor(); | 640 virtual ~Constructor(); |
714 | 641 |
715 DEFINE_CASTING_OPERATIONS(Constructor); | 642 DEFINE_CASTING_OPERATIONS(Constructor); |
716 | 643 |
717 virtual void AcceptMemberVisitor(MemberVisitor* visitor); | |
718 virtual void VisitChildren(Visitor* visitor); | |
719 | |
720 bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; } | 644 bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; } |
721 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } | 645 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } |
722 | 646 |
723 FunctionNode* function() { return function_; } | 647 FunctionNode* function() { return function_; } |
724 List<Initializer>& initializers() { return initializers_; } | 648 List<Initializer>& initializers() { return initializers_; } |
725 | 649 |
726 private: | 650 private: |
727 template <typename T> | 651 template <typename T> |
728 friend class List; | 652 friend class List; |
729 | 653 |
(...skipping 26 matching lines...) Expand all Loading... |
756 | 680 |
757 kIncompleteProcedure = 255 | 681 kIncompleteProcedure = 255 |
758 }; | 682 }; |
759 | 683 |
760 Procedure* ReadFrom(Reader* reader); | 684 Procedure* ReadFrom(Reader* reader); |
761 | 685 |
762 virtual ~Procedure(); | 686 virtual ~Procedure(); |
763 | 687 |
764 DEFINE_CASTING_OPERATIONS(Procedure); | 688 DEFINE_CASTING_OPERATIONS(Procedure); |
765 | 689 |
766 virtual void AcceptMemberVisitor(MemberVisitor* visitor); | |
767 virtual void VisitChildren(Visitor* visitor); | |
768 | |
769 ProcedureKind kind() { return kind_; } | 690 ProcedureKind kind() { return kind_; } |
770 FunctionNode* function() { return function_; } | 691 FunctionNode* function() { return function_; } |
771 | 692 |
772 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; } | 693 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; } |
773 bool IsAbstract() { return (flags_ & kFlagAbstract) == kFlagAbstract; } | 694 bool IsAbstract() { return (flags_ & kFlagAbstract) == kFlagAbstract; } |
774 bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; } | 695 bool IsExternal() { return (flags_ & kFlagExternal) == kFlagExternal; } |
775 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } | 696 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } |
776 intptr_t source_uri_index() { return source_uri_index_; } | 697 intptr_t source_uri_index() { return source_uri_index_; } |
777 | 698 |
778 private: | 699 private: |
(...skipping 12 matching lines...) Expand all Loading... |
791 | 712 |
792 | 713 |
793 class Initializer : public TreeNode { | 714 class Initializer : public TreeNode { |
794 public: | 715 public: |
795 static Initializer* ReadFrom(Reader* reader); | 716 static Initializer* ReadFrom(Reader* reader); |
796 | 717 |
797 virtual ~Initializer(); | 718 virtual ~Initializer(); |
798 | 719 |
799 DEFINE_CASTING_OPERATIONS(Initializer); | 720 DEFINE_CASTING_OPERATIONS(Initializer); |
800 | 721 |
801 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
802 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor) = 0; | |
803 | |
804 protected: | 722 protected: |
805 Initializer() {} | 723 Initializer() {} |
806 | 724 |
807 private: | 725 private: |
808 DISALLOW_COPY_AND_ASSIGN(Initializer); | 726 DISALLOW_COPY_AND_ASSIGN(Initializer); |
809 }; | 727 }; |
810 | 728 |
811 | 729 |
812 class InvalidInitializer : public Initializer { | 730 class InvalidInitializer : public Initializer { |
813 public: | 731 public: |
814 static InvalidInitializer* ReadFromImpl(Reader* reader); | 732 static InvalidInitializer* ReadFromImpl(Reader* reader); |
815 | 733 |
816 virtual ~InvalidInitializer(); | 734 virtual ~InvalidInitializer(); |
817 | 735 |
818 DEFINE_CASTING_OPERATIONS(InvalidInitializer); | 736 DEFINE_CASTING_OPERATIONS(InvalidInitializer); |
819 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | |
820 virtual void VisitChildren(Visitor* visitor); | |
821 | 737 |
822 private: | 738 private: |
823 InvalidInitializer() {} | 739 InvalidInitializer() {} |
824 | 740 |
825 DISALLOW_COPY_AND_ASSIGN(InvalidInitializer); | 741 DISALLOW_COPY_AND_ASSIGN(InvalidInitializer); |
826 }; | 742 }; |
827 | 743 |
828 | 744 |
829 class FieldInitializer : public Initializer { | 745 class FieldInitializer : public Initializer { |
830 public: | 746 public: |
831 static FieldInitializer* ReadFromImpl(Reader* reader); | 747 static FieldInitializer* ReadFromImpl(Reader* reader); |
832 | 748 |
833 virtual ~FieldInitializer(); | 749 virtual ~FieldInitializer(); |
834 | 750 |
835 DEFINE_CASTING_OPERATIONS(FieldInitializer); | 751 DEFINE_CASTING_OPERATIONS(FieldInitializer); |
836 | 752 |
837 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | |
838 virtual void VisitChildren(Visitor* visitor); | |
839 | |
840 NameIndex field() { return field_reference_; } | 753 NameIndex field() { return field_reference_; } |
841 Expression* value() { return value_; } | 754 Expression* value() { return value_; } |
842 | 755 |
843 private: | 756 private: |
844 FieldInitializer() {} | 757 FieldInitializer() {} |
845 | 758 |
846 NameIndex field_reference_; // Field canonical name. | 759 NameIndex field_reference_; // Field canonical name. |
847 Child<Expression> value_; | 760 Child<Expression> value_; |
848 | 761 |
849 DISALLOW_COPY_AND_ASSIGN(FieldInitializer); | 762 DISALLOW_COPY_AND_ASSIGN(FieldInitializer); |
850 }; | 763 }; |
851 | 764 |
852 | 765 |
853 class SuperInitializer : public Initializer { | 766 class SuperInitializer : public Initializer { |
854 public: | 767 public: |
855 static SuperInitializer* ReadFromImpl(Reader* reader); | 768 static SuperInitializer* ReadFromImpl(Reader* reader); |
856 | 769 |
857 virtual ~SuperInitializer(); | 770 virtual ~SuperInitializer(); |
858 | 771 |
859 DEFINE_CASTING_OPERATIONS(SuperInitializer); | 772 DEFINE_CASTING_OPERATIONS(SuperInitializer); |
860 | 773 |
861 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | |
862 virtual void VisitChildren(Visitor* visitor); | |
863 | |
864 NameIndex target() { return target_reference_; } | 774 NameIndex target() { return target_reference_; } |
865 Arguments* arguments() { return arguments_; } | 775 Arguments* arguments() { return arguments_; } |
866 | 776 |
867 private: | 777 private: |
868 SuperInitializer() {} | 778 SuperInitializer() {} |
869 | 779 |
870 NameIndex target_reference_; // Constructor canonical name. | 780 NameIndex target_reference_; // Constructor canonical name. |
871 Child<Arguments> arguments_; | 781 Child<Arguments> arguments_; |
872 | 782 |
873 DISALLOW_COPY_AND_ASSIGN(SuperInitializer); | 783 DISALLOW_COPY_AND_ASSIGN(SuperInitializer); |
874 }; | 784 }; |
875 | 785 |
876 | 786 |
877 class RedirectingInitializer : public Initializer { | 787 class RedirectingInitializer : public Initializer { |
878 public: | 788 public: |
879 static RedirectingInitializer* ReadFromImpl(Reader* reader); | 789 static RedirectingInitializer* ReadFromImpl(Reader* reader); |
880 | 790 |
881 virtual ~RedirectingInitializer(); | 791 virtual ~RedirectingInitializer(); |
882 | 792 |
883 DEFINE_CASTING_OPERATIONS(RedirectingInitializer); | 793 DEFINE_CASTING_OPERATIONS(RedirectingInitializer); |
884 | 794 |
885 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | |
886 virtual void VisitChildren(Visitor* visitor); | |
887 | |
888 NameIndex target() { return target_reference_; } | 795 NameIndex target() { return target_reference_; } |
889 Arguments* arguments() { return arguments_; } | 796 Arguments* arguments() { return arguments_; } |
890 | 797 |
891 private: | 798 private: |
892 RedirectingInitializer() {} | 799 RedirectingInitializer() {} |
893 | 800 |
894 NameIndex target_reference_; // Constructor canonical name. | 801 NameIndex target_reference_; // Constructor canonical name. |
895 Child<Arguments> arguments_; | 802 Child<Arguments> arguments_; |
896 | 803 |
897 DISALLOW_COPY_AND_ASSIGN(RedirectingInitializer); | 804 DISALLOW_COPY_AND_ASSIGN(RedirectingInitializer); |
898 }; | 805 }; |
899 | 806 |
900 | 807 |
901 class LocalInitializer : public Initializer { | 808 class LocalInitializer : public Initializer { |
902 public: | 809 public: |
903 static LocalInitializer* ReadFromImpl(Reader* reader); | 810 static LocalInitializer* ReadFromImpl(Reader* reader); |
904 | 811 |
905 virtual ~LocalInitializer(); | 812 virtual ~LocalInitializer(); |
906 | 813 |
907 DEFINE_CASTING_OPERATIONS(LocalInitializer); | 814 DEFINE_CASTING_OPERATIONS(LocalInitializer); |
908 | 815 |
909 virtual void AcceptInitializerVisitor(InitializerVisitor* visitor); | |
910 virtual void VisitChildren(Visitor* visitor); | |
911 | |
912 VariableDeclaration* variable() { return variable_; } | 816 VariableDeclaration* variable() { return variable_; } |
913 | 817 |
914 private: | 818 private: |
915 LocalInitializer() {} | 819 LocalInitializer() {} |
916 | 820 |
917 Child<VariableDeclaration> variable_; | 821 Child<VariableDeclaration> variable_; |
918 | 822 |
919 DISALLOW_COPY_AND_ASSIGN(LocalInitializer); | 823 DISALLOW_COPY_AND_ASSIGN(LocalInitializer); |
920 }; | 824 }; |
921 | 825 |
922 | 826 |
923 class FunctionNode : public TreeNode { | 827 class FunctionNode : public TreeNode { |
924 public: | 828 public: |
925 enum AsyncMarker { | 829 enum AsyncMarker { |
926 kSync = 0, | 830 kSync = 0, |
927 kSyncStar = 1, | 831 kSyncStar = 1, |
928 kAsync = 2, | 832 kAsync = 2, |
929 kAsyncStar = 3, | 833 kAsyncStar = 3, |
930 kSyncYielding = 4, | 834 kSyncYielding = 4, |
931 }; | 835 }; |
932 | 836 |
933 static FunctionNode* ReadFrom(Reader* reader); | 837 static FunctionNode* ReadFrom(Reader* reader); |
934 | 838 |
935 virtual ~FunctionNode(); | 839 virtual ~FunctionNode(); |
936 | 840 |
937 DEFINE_CASTING_OPERATIONS(FunctionNode); | 841 DEFINE_CASTING_OPERATIONS(FunctionNode); |
938 | 842 |
939 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
940 virtual void VisitChildren(Visitor* visitor); | |
941 | |
942 AsyncMarker async_marker() { return async_marker_; } | 843 AsyncMarker async_marker() { return async_marker_; } |
943 AsyncMarker dart_async_marker() { return dart_async_marker_; } | 844 AsyncMarker dart_async_marker() { return dart_async_marker_; } |
944 TypeParameterList& type_parameters() { return type_parameters_; } | 845 TypeParameterList& type_parameters() { return type_parameters_; } |
945 int required_parameter_count() { return required_parameter_count_; } | 846 int required_parameter_count() { return required_parameter_count_; } |
946 List<VariableDeclaration>& positional_parameters() { | 847 List<VariableDeclaration>& positional_parameters() { |
947 return positional_parameters_; | 848 return positional_parameters_; |
948 } | 849 } |
949 List<VariableDeclaration>& named_parameters() { return named_parameters_; } | 850 List<VariableDeclaration>& named_parameters() { return named_parameters_; } |
950 DartType* return_type() { return return_type_; } | 851 DartType* return_type() { return return_type_; } |
951 | 852 |
(...skipping 24 matching lines...) Expand all Loading... |
976 | 877 |
977 | 878 |
978 class Expression : public TreeNode { | 879 class Expression : public TreeNode { |
979 public: | 880 public: |
980 static Expression* ReadFrom(Reader* reader); | 881 static Expression* ReadFrom(Reader* reader); |
981 | 882 |
982 virtual ~Expression(); | 883 virtual ~Expression(); |
983 | 884 |
984 DEFINE_CASTING_OPERATIONS(Expression); | 885 DEFINE_CASTING_OPERATIONS(Expression); |
985 | 886 |
986 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
987 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor) = 0; | 887 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor) = 0; |
988 TokenPosition position() { return position_; } | 888 TokenPosition position() { return position_; } |
989 void set_position(TokenPosition position) { position_ = position; } | 889 void set_position(TokenPosition position) { position_ = position; } |
990 | 890 |
991 protected: | 891 protected: |
992 Expression() : position_(TokenPosition::kNoSource) {} | 892 Expression() : position_(TokenPosition::kNoSource) {} |
993 TokenPosition position_; | 893 TokenPosition position_; |
994 | 894 |
995 private: | 895 private: |
996 DISALLOW_COPY_AND_ASSIGN(Expression); | 896 DISALLOW_COPY_AND_ASSIGN(Expression); |
997 }; | 897 }; |
998 | 898 |
999 | 899 |
1000 class InvalidExpression : public Expression { | 900 class InvalidExpression : public Expression { |
1001 public: | 901 public: |
1002 static InvalidExpression* ReadFrom(Reader* reader); | 902 static InvalidExpression* ReadFrom(Reader* reader); |
1003 | 903 |
1004 virtual ~InvalidExpression(); | 904 virtual ~InvalidExpression(); |
1005 virtual void VisitChildren(Visitor* visitor); | |
1006 | 905 |
1007 DEFINE_CASTING_OPERATIONS(InvalidExpression); | 906 DEFINE_CASTING_OPERATIONS(InvalidExpression); |
1008 | 907 |
1009 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 908 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1010 | 909 |
1011 private: | 910 private: |
1012 InvalidExpression() {} | 911 InvalidExpression() {} |
1013 | 912 |
1014 DISALLOW_COPY_AND_ASSIGN(InvalidExpression); | 913 DISALLOW_COPY_AND_ASSIGN(InvalidExpression); |
1015 }; | 914 }; |
1016 | 915 |
1017 | 916 |
1018 class VariableGet : public Expression { | 917 class VariableGet : public Expression { |
1019 public: | 918 public: |
1020 static VariableGet* ReadFrom(Reader* reader); | 919 static VariableGet* ReadFrom(Reader* reader); |
1021 static VariableGet* ReadFrom(Reader* reader, uint8_t payload); | 920 static VariableGet* ReadFrom(Reader* reader, uint8_t payload); |
1022 | 921 |
1023 virtual ~VariableGet(); | 922 virtual ~VariableGet(); |
1024 | 923 |
1025 DEFINE_CASTING_OPERATIONS(VariableGet); | 924 DEFINE_CASTING_OPERATIONS(VariableGet); |
1026 | 925 |
1027 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 926 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1028 virtual void VisitChildren(Visitor* visitor); | |
1029 | 927 |
1030 VariableDeclaration* variable() { return variable_; } | 928 VariableDeclaration* variable() { return variable_; } |
1031 | 929 |
1032 private: | 930 private: |
1033 VariableGet() {} | 931 VariableGet() {} |
1034 | 932 |
1035 Ref<VariableDeclaration> variable_; | 933 Ref<VariableDeclaration> variable_; |
1036 intptr_t variable_kernel_offset_; | 934 intptr_t variable_kernel_offset_; |
1037 | 935 |
1038 DISALLOW_COPY_AND_ASSIGN(VariableGet); | 936 DISALLOW_COPY_AND_ASSIGN(VariableGet); |
1039 }; | 937 }; |
1040 | 938 |
1041 | 939 |
1042 class VariableSet : public Expression { | 940 class VariableSet : public Expression { |
1043 public: | 941 public: |
1044 static VariableSet* ReadFrom(Reader* reader); | 942 static VariableSet* ReadFrom(Reader* reader); |
1045 static VariableSet* ReadFrom(Reader* reader, uint8_t payload); | 943 static VariableSet* ReadFrom(Reader* reader, uint8_t payload); |
1046 | 944 |
1047 virtual ~VariableSet(); | 945 virtual ~VariableSet(); |
1048 | 946 |
1049 DEFINE_CASTING_OPERATIONS(VariableSet); | 947 DEFINE_CASTING_OPERATIONS(VariableSet); |
1050 | 948 |
1051 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 949 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1052 virtual void VisitChildren(Visitor* visitor); | |
1053 | 950 |
1054 VariableDeclaration* variable() { return variable_; } | 951 VariableDeclaration* variable() { return variable_; } |
1055 Expression* expression() { return expression_; } | 952 Expression* expression() { return expression_; } |
1056 | 953 |
1057 private: | 954 private: |
1058 VariableSet() {} | 955 VariableSet() {} |
1059 | 956 |
1060 Ref<VariableDeclaration> variable_; | 957 Ref<VariableDeclaration> variable_; |
1061 intptr_t variable_kernel_offset_; | 958 intptr_t variable_kernel_offset_; |
1062 Child<Expression> expression_; | 959 Child<Expression> expression_; |
1063 | 960 |
1064 DISALLOW_COPY_AND_ASSIGN(VariableSet); | 961 DISALLOW_COPY_AND_ASSIGN(VariableSet); |
1065 }; | 962 }; |
1066 | 963 |
1067 | 964 |
1068 class PropertyGet : public Expression { | 965 class PropertyGet : public Expression { |
1069 public: | 966 public: |
1070 static PropertyGet* ReadFrom(Reader* reader); | 967 static PropertyGet* ReadFrom(Reader* reader); |
1071 | 968 |
1072 virtual ~PropertyGet(); | 969 virtual ~PropertyGet(); |
1073 | 970 |
1074 DEFINE_CASTING_OPERATIONS(PropertyGet); | 971 DEFINE_CASTING_OPERATIONS(PropertyGet); |
1075 | 972 |
1076 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 973 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1077 virtual void VisitChildren(Visitor* visitor); | |
1078 | 974 |
1079 Expression* receiver() { return receiver_; } | 975 Expression* receiver() { return receiver_; } |
1080 Name* name() { return name_; } | 976 Name* name() { return name_; } |
1081 | 977 |
1082 private: | 978 private: |
1083 PropertyGet() {} | 979 PropertyGet() {} |
1084 | 980 |
1085 NameIndex interface_target_reference_; | 981 NameIndex interface_target_reference_; |
1086 Child<Expression> receiver_; | 982 Child<Expression> receiver_; |
1087 Child<Name> name_; | 983 Child<Name> name_; |
1088 | 984 |
1089 DISALLOW_COPY_AND_ASSIGN(PropertyGet); | 985 DISALLOW_COPY_AND_ASSIGN(PropertyGet); |
1090 }; | 986 }; |
1091 | 987 |
1092 | 988 |
1093 class PropertySet : public Expression { | 989 class PropertySet : public Expression { |
1094 public: | 990 public: |
1095 static PropertySet* ReadFrom(Reader* reader); | 991 static PropertySet* ReadFrom(Reader* reader); |
1096 | 992 |
1097 virtual ~PropertySet(); | 993 virtual ~PropertySet(); |
1098 | 994 |
1099 DEFINE_CASTING_OPERATIONS(PropertySet); | 995 DEFINE_CASTING_OPERATIONS(PropertySet); |
1100 | 996 |
1101 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 997 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1102 virtual void VisitChildren(Visitor* visitor); | |
1103 | 998 |
1104 Expression* receiver() { return receiver_; } | 999 Expression* receiver() { return receiver_; } |
1105 Name* name() { return name_; } | 1000 Name* name() { return name_; } |
1106 Expression* value() { return value_; } | 1001 Expression* value() { return value_; } |
1107 | 1002 |
1108 private: | 1003 private: |
1109 PropertySet() {} | 1004 PropertySet() {} |
1110 | 1005 |
1111 NameIndex interface_target_reference_; | 1006 NameIndex interface_target_reference_; |
1112 Child<Expression> receiver_; | 1007 Child<Expression> receiver_; |
1113 Child<Name> name_; | 1008 Child<Name> name_; |
1114 Child<Expression> value_; | 1009 Child<Expression> value_; |
1115 | 1010 |
1116 DISALLOW_COPY_AND_ASSIGN(PropertySet); | 1011 DISALLOW_COPY_AND_ASSIGN(PropertySet); |
1117 }; | 1012 }; |
1118 | 1013 |
1119 | 1014 |
1120 class DirectPropertyGet : public Expression { | 1015 class DirectPropertyGet : public Expression { |
1121 public: | 1016 public: |
1122 static DirectPropertyGet* ReadFrom(Reader* reader); | 1017 static DirectPropertyGet* ReadFrom(Reader* reader); |
1123 | 1018 |
1124 virtual ~DirectPropertyGet(); | 1019 virtual ~DirectPropertyGet(); |
1125 | 1020 |
1126 DEFINE_CASTING_OPERATIONS(DirectPropertyGet); | 1021 DEFINE_CASTING_OPERATIONS(DirectPropertyGet); |
1127 | 1022 |
1128 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1023 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1129 virtual void VisitChildren(Visitor* visitor); | |
1130 | 1024 |
1131 Expression* receiver() { return receiver_; } | 1025 Expression* receiver() { return receiver_; } |
1132 NameIndex target() { return target_reference_; } | 1026 NameIndex target() { return target_reference_; } |
1133 | 1027 |
1134 private: | 1028 private: |
1135 DirectPropertyGet() {} | 1029 DirectPropertyGet() {} |
1136 | 1030 |
1137 NameIndex target_reference_; // Member canonical name. | 1031 NameIndex target_reference_; // Member canonical name. |
1138 Child<Expression> receiver_; | 1032 Child<Expression> receiver_; |
1139 | 1033 |
1140 DISALLOW_COPY_AND_ASSIGN(DirectPropertyGet); | 1034 DISALLOW_COPY_AND_ASSIGN(DirectPropertyGet); |
1141 }; | 1035 }; |
1142 | 1036 |
1143 | 1037 |
1144 class DirectPropertySet : public Expression { | 1038 class DirectPropertySet : public Expression { |
1145 public: | 1039 public: |
1146 static DirectPropertySet* ReadFrom(Reader* reader); | 1040 static DirectPropertySet* ReadFrom(Reader* reader); |
1147 | 1041 |
1148 virtual ~DirectPropertySet(); | 1042 virtual ~DirectPropertySet(); |
1149 | 1043 |
1150 DEFINE_CASTING_OPERATIONS(DirectPropertySet); | 1044 DEFINE_CASTING_OPERATIONS(DirectPropertySet); |
1151 | 1045 |
1152 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1046 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1153 virtual void VisitChildren(Visitor* visitor); | |
1154 | 1047 |
1155 NameIndex target() { return target_reference_; } | 1048 NameIndex target() { return target_reference_; } |
1156 Expression* receiver() { return receiver_; } | 1049 Expression* receiver() { return receiver_; } |
1157 Expression* value() { return value_; } | 1050 Expression* value() { return value_; } |
1158 | 1051 |
1159 private: | 1052 private: |
1160 DirectPropertySet() {} | 1053 DirectPropertySet() {} |
1161 | 1054 |
1162 NameIndex target_reference_; // Member canonical name. | 1055 NameIndex target_reference_; // Member canonical name. |
1163 Child<Expression> receiver_; | 1056 Child<Expression> receiver_; |
1164 Child<Expression> value_; | 1057 Child<Expression> value_; |
1165 | 1058 |
1166 DISALLOW_COPY_AND_ASSIGN(DirectPropertySet); | 1059 DISALLOW_COPY_AND_ASSIGN(DirectPropertySet); |
1167 }; | 1060 }; |
1168 | 1061 |
1169 | 1062 |
1170 class StaticGet : public Expression { | 1063 class StaticGet : public Expression { |
1171 public: | 1064 public: |
1172 StaticGet(NameIndex target, bool can_stream) : target_reference_(target) { | |
1173 can_stream_ = can_stream; | |
1174 } | |
1175 | |
1176 static StaticGet* ReadFrom(Reader* reader); | 1065 static StaticGet* ReadFrom(Reader* reader); |
1177 | 1066 |
1178 virtual ~StaticGet(); | 1067 virtual ~StaticGet(); |
1179 | 1068 |
1180 DEFINE_CASTING_OPERATIONS(StaticGet); | 1069 DEFINE_CASTING_OPERATIONS(StaticGet); |
1181 | 1070 |
1182 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1071 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1183 virtual void VisitChildren(Visitor* visitor); | |
1184 | 1072 |
1185 NameIndex target() { return target_reference_; } | 1073 NameIndex target() { return target_reference_; } |
1186 | 1074 |
1187 private: | 1075 private: |
1188 StaticGet() {} | 1076 StaticGet() {} |
1189 | 1077 |
1190 NameIndex target_reference_; // Member canonical name. | 1078 NameIndex target_reference_; // Member canonical name. |
1191 | 1079 |
1192 DISALLOW_COPY_AND_ASSIGN(StaticGet); | 1080 DISALLOW_COPY_AND_ASSIGN(StaticGet); |
1193 }; | 1081 }; |
1194 | 1082 |
1195 | 1083 |
1196 class StaticSet : public Expression { | 1084 class StaticSet : public Expression { |
1197 public: | 1085 public: |
1198 static StaticSet* ReadFrom(Reader* reader); | 1086 static StaticSet* ReadFrom(Reader* reader); |
1199 | 1087 |
1200 virtual ~StaticSet(); | 1088 virtual ~StaticSet(); |
1201 | 1089 |
1202 DEFINE_CASTING_OPERATIONS(StaticSet); | 1090 DEFINE_CASTING_OPERATIONS(StaticSet); |
1203 | 1091 |
1204 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1092 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1205 virtual void VisitChildren(Visitor* visitor); | |
1206 | 1093 |
1207 NameIndex target() { return target_reference_; } | 1094 NameIndex target() { return target_reference_; } |
1208 Expression* expression() { return expression_; } | 1095 Expression* expression() { return expression_; } |
1209 | 1096 |
1210 private: | 1097 private: |
1211 StaticSet() {} | 1098 StaticSet() {} |
1212 | 1099 |
1213 NameIndex target_reference_; // Member canonical name. | 1100 NameIndex target_reference_; // Member canonical name. |
1214 Child<Expression> expression_; | 1101 Child<Expression> expression_; |
1215 | 1102 |
1216 DISALLOW_COPY_AND_ASSIGN(StaticSet); | 1103 DISALLOW_COPY_AND_ASSIGN(StaticSet); |
1217 }; | 1104 }; |
1218 | 1105 |
1219 | 1106 |
1220 class Arguments : public TreeNode { | 1107 class Arguments : public TreeNode { |
1221 public: | 1108 public: |
1222 static Arguments* ReadFrom(Reader* reader); | 1109 static Arguments* ReadFrom(Reader* reader); |
1223 | 1110 |
1224 virtual ~Arguments(); | 1111 virtual ~Arguments(); |
1225 | 1112 |
1226 DEFINE_CASTING_OPERATIONS(Arguments); | 1113 DEFINE_CASTING_OPERATIONS(Arguments); |
1227 | 1114 |
1228 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
1229 virtual void VisitChildren(Visitor* visitor); | |
1230 | |
1231 List<DartType>& types() { return types_; } | 1115 List<DartType>& types() { return types_; } |
1232 List<Expression>& positional() { return positional_; } | 1116 List<Expression>& positional() { return positional_; } |
1233 List<NamedExpression>& named() { return named_; } | 1117 List<NamedExpression>& named() { return named_; } |
1234 | 1118 |
1235 int count() { return positional_.length() + named_.length(); } | 1119 int count() { return positional_.length() + named_.length(); } |
1236 | 1120 |
1237 private: | 1121 private: |
1238 Arguments() {} | 1122 Arguments() {} |
1239 | 1123 |
1240 List<DartType> types_; | 1124 List<DartType> types_; |
1241 List<Expression> positional_; | 1125 List<Expression> positional_; |
1242 List<NamedExpression> named_; | 1126 List<NamedExpression> named_; |
1243 | 1127 |
1244 DISALLOW_COPY_AND_ASSIGN(Arguments); | 1128 DISALLOW_COPY_AND_ASSIGN(Arguments); |
1245 }; | 1129 }; |
1246 | 1130 |
1247 | 1131 |
1248 class NamedExpression : public TreeNode { | 1132 class NamedExpression : public TreeNode { |
1249 public: | 1133 public: |
1250 static NamedExpression* ReadFrom(Reader* reader); | 1134 static NamedExpression* ReadFrom(Reader* reader); |
1251 | 1135 |
1252 NamedExpression(StringIndex name_index, Expression* expr) | 1136 NamedExpression(StringIndex name_index, Expression* expr) |
1253 : name_index_(name_index), expression_(expr) {} | 1137 : name_index_(name_index), expression_(expr) {} |
1254 virtual ~NamedExpression(); | 1138 virtual ~NamedExpression(); |
1255 | 1139 |
1256 DEFINE_CASTING_OPERATIONS(NamedExpression); | 1140 DEFINE_CASTING_OPERATIONS(NamedExpression); |
1257 | 1141 |
1258 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
1259 virtual void VisitChildren(Visitor* visitor); | |
1260 | |
1261 StringIndex name() { return name_index_; } | 1142 StringIndex name() { return name_index_; } |
1262 Expression* expression() { return expression_; } | 1143 Expression* expression() { return expression_; } |
1263 | 1144 |
1264 private: | 1145 private: |
1265 NamedExpression() {} | 1146 NamedExpression() {} |
1266 | 1147 |
1267 StringIndex name_index_; | 1148 StringIndex name_index_; |
1268 Child<Expression> expression_; | 1149 Child<Expression> expression_; |
1269 | 1150 |
1270 DISALLOW_COPY_AND_ASSIGN(NamedExpression); | 1151 DISALLOW_COPY_AND_ASSIGN(NamedExpression); |
1271 }; | 1152 }; |
1272 | 1153 |
1273 | 1154 |
1274 class MethodInvocation : public Expression { | 1155 class MethodInvocation : public Expression { |
1275 public: | 1156 public: |
1276 static MethodInvocation* ReadFrom(Reader* reader); | 1157 static MethodInvocation* ReadFrom(Reader* reader); |
1277 | 1158 |
1278 virtual ~MethodInvocation(); | 1159 virtual ~MethodInvocation(); |
1279 | 1160 |
1280 DEFINE_CASTING_OPERATIONS(MethodInvocation); | 1161 DEFINE_CASTING_OPERATIONS(MethodInvocation); |
1281 | 1162 |
1282 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1163 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1283 virtual void VisitChildren(Visitor* visitor); | |
1284 | 1164 |
1285 Expression* receiver() { return receiver_; } | 1165 Expression* receiver() { return receiver_; } |
1286 Name* name() { return name_; } | 1166 Name* name() { return name_; } |
1287 Arguments* arguments() { return arguments_; } | 1167 Arguments* arguments() { return arguments_; } |
1288 | 1168 |
1289 private: | 1169 private: |
1290 MethodInvocation() {} | 1170 MethodInvocation() {} |
1291 | 1171 |
1292 NameIndex interface_target_reference_; | 1172 NameIndex interface_target_reference_; |
1293 Child<Expression> receiver_; | 1173 Child<Expression> receiver_; |
1294 Child<Name> name_; | 1174 Child<Name> name_; |
1295 Child<Arguments> arguments_; | 1175 Child<Arguments> arguments_; |
1296 | 1176 |
1297 DISALLOW_COPY_AND_ASSIGN(MethodInvocation); | 1177 DISALLOW_COPY_AND_ASSIGN(MethodInvocation); |
1298 }; | 1178 }; |
1299 | 1179 |
1300 | 1180 |
1301 class DirectMethodInvocation : public Expression { | 1181 class DirectMethodInvocation : public Expression { |
1302 public: | 1182 public: |
1303 static DirectMethodInvocation* ReadFrom(Reader* reader); | 1183 static DirectMethodInvocation* ReadFrom(Reader* reader); |
1304 | 1184 |
1305 virtual ~DirectMethodInvocation(); | 1185 virtual ~DirectMethodInvocation(); |
1306 | 1186 |
1307 DEFINE_CASTING_OPERATIONS(DirectMethodInvocation); | 1187 DEFINE_CASTING_OPERATIONS(DirectMethodInvocation); |
1308 | 1188 |
1309 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1189 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1310 virtual void VisitChildren(Visitor* visitor); | |
1311 | 1190 |
1312 Expression* receiver() { return receiver_; } | 1191 Expression* receiver() { return receiver_; } |
1313 NameIndex target() { return target_reference_; } | 1192 NameIndex target() { return target_reference_; } |
1314 Arguments* arguments() { return arguments_; } | 1193 Arguments* arguments() { return arguments_; } |
1315 | 1194 |
1316 private: | 1195 private: |
1317 DirectMethodInvocation() {} | 1196 DirectMethodInvocation() {} |
1318 | 1197 |
1319 NameIndex target_reference_; // Procedure canonical name. | 1198 NameIndex target_reference_; // Procedure canonical name. |
1320 Child<Expression> receiver_; | 1199 Child<Expression> receiver_; |
1321 Child<Arguments> arguments_; | 1200 Child<Arguments> arguments_; |
1322 | 1201 |
1323 DISALLOW_COPY_AND_ASSIGN(DirectMethodInvocation); | 1202 DISALLOW_COPY_AND_ASSIGN(DirectMethodInvocation); |
1324 }; | 1203 }; |
1325 | 1204 |
1326 | 1205 |
1327 class StaticInvocation : public Expression { | 1206 class StaticInvocation : public Expression { |
1328 public: | 1207 public: |
1329 static StaticInvocation* ReadFrom(Reader* reader, bool is_const); | 1208 static StaticInvocation* ReadFrom(Reader* reader, bool is_const); |
1330 ~StaticInvocation(); | 1209 ~StaticInvocation(); |
1331 | 1210 |
1332 DEFINE_CASTING_OPERATIONS(StaticInvocation); | 1211 DEFINE_CASTING_OPERATIONS(StaticInvocation); |
1333 | 1212 |
1334 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1213 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1335 virtual void VisitChildren(Visitor* visitor); | |
1336 | 1214 |
1337 NameIndex procedure() { return procedure_reference_; } | 1215 NameIndex procedure() { return procedure_reference_; } |
1338 Arguments* arguments() { return arguments_; } | 1216 Arguments* arguments() { return arguments_; } |
1339 bool is_const() { return is_const_; } | 1217 bool is_const() { return is_const_; } |
1340 | 1218 |
1341 private: | 1219 private: |
1342 StaticInvocation() {} | 1220 StaticInvocation() {} |
1343 | 1221 |
1344 NameIndex procedure_reference_; // Procedure canonical name. | 1222 NameIndex procedure_reference_; // Procedure canonical name. |
1345 bool is_const_; | 1223 bool is_const_; |
1346 Child<Arguments> arguments_; | 1224 Child<Arguments> arguments_; |
1347 | 1225 |
1348 DISALLOW_COPY_AND_ASSIGN(StaticInvocation); | 1226 DISALLOW_COPY_AND_ASSIGN(StaticInvocation); |
1349 }; | 1227 }; |
1350 | 1228 |
1351 | 1229 |
1352 class ConstructorInvocation : public Expression { | 1230 class ConstructorInvocation : public Expression { |
1353 public: | 1231 public: |
1354 static ConstructorInvocation* ReadFrom(Reader* reader, bool is_const); | 1232 static ConstructorInvocation* ReadFrom(Reader* reader, bool is_const); |
1355 | 1233 |
1356 virtual ~ConstructorInvocation(); | 1234 virtual ~ConstructorInvocation(); |
1357 | 1235 |
1358 DEFINE_CASTING_OPERATIONS(ConstructorInvocation); | 1236 DEFINE_CASTING_OPERATIONS(ConstructorInvocation); |
1359 | 1237 |
1360 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1238 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1361 virtual void VisitChildren(Visitor* visitor); | |
1362 | 1239 |
1363 bool is_const() { return is_const_; } | 1240 bool is_const() { return is_const_; } |
1364 NameIndex target() { return target_reference_; } | 1241 NameIndex target() { return target_reference_; } |
1365 Arguments* arguments() { return arguments_; } | 1242 Arguments* arguments() { return arguments_; } |
1366 | 1243 |
1367 private: | 1244 private: |
1368 ConstructorInvocation() {} | 1245 ConstructorInvocation() {} |
1369 | 1246 |
1370 bool is_const_; | 1247 bool is_const_; |
1371 NameIndex target_reference_; // Constructor canonical name. | 1248 NameIndex target_reference_; // Constructor canonical name. |
1372 Child<Arguments> arguments_; | 1249 Child<Arguments> arguments_; |
1373 | 1250 |
1374 DISALLOW_COPY_AND_ASSIGN(ConstructorInvocation); | 1251 DISALLOW_COPY_AND_ASSIGN(ConstructorInvocation); |
1375 }; | 1252 }; |
1376 | 1253 |
1377 | 1254 |
1378 class Not : public Expression { | 1255 class Not : public Expression { |
1379 public: | 1256 public: |
1380 static Not* ReadFrom(Reader* reader); | 1257 static Not* ReadFrom(Reader* reader); |
1381 | 1258 |
1382 virtual ~Not(); | 1259 virtual ~Not(); |
1383 | 1260 |
1384 DEFINE_CASTING_OPERATIONS(Not); | 1261 DEFINE_CASTING_OPERATIONS(Not); |
1385 | 1262 |
1386 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1263 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1387 virtual void VisitChildren(Visitor* visitor); | |
1388 | 1264 |
1389 Expression* expression() { return expression_; } | 1265 Expression* expression() { return expression_; } |
1390 | 1266 |
1391 private: | 1267 private: |
1392 Not() {} | 1268 Not() {} |
1393 | 1269 |
1394 Child<Expression> expression_; | 1270 Child<Expression> expression_; |
1395 | 1271 |
1396 DISALLOW_COPY_AND_ASSIGN(Not); | 1272 DISALLOW_COPY_AND_ASSIGN(Not); |
1397 }; | 1273 }; |
1398 | 1274 |
1399 | 1275 |
1400 class LogicalExpression : public Expression { | 1276 class LogicalExpression : public Expression { |
1401 public: | 1277 public: |
1402 enum Operator { kAnd, kOr }; | 1278 enum Operator { kAnd, kOr }; |
1403 | 1279 |
1404 static LogicalExpression* ReadFrom(Reader* reader); | 1280 static LogicalExpression* ReadFrom(Reader* reader); |
1405 | 1281 |
1406 virtual ~LogicalExpression(); | 1282 virtual ~LogicalExpression(); |
1407 | 1283 |
1408 DEFINE_CASTING_OPERATIONS(LogicalExpression); | 1284 DEFINE_CASTING_OPERATIONS(LogicalExpression); |
1409 | 1285 |
1410 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1286 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1411 virtual void VisitChildren(Visitor* visitor); | |
1412 | 1287 |
1413 Expression* left() { return left_; } | 1288 Expression* left() { return left_; } |
1414 Operator op() { return operator_; } | 1289 Operator op() { return operator_; } |
1415 Expression* right() { return right_; } | 1290 Expression* right() { return right_; } |
1416 | 1291 |
1417 private: | 1292 private: |
1418 LogicalExpression() {} | 1293 LogicalExpression() {} |
1419 | 1294 |
1420 Child<Expression> left_; | 1295 Child<Expression> left_; |
1421 Operator operator_; | 1296 Operator operator_; |
1422 Child<Expression> right_; | 1297 Child<Expression> right_; |
1423 | 1298 |
1424 DISALLOW_COPY_AND_ASSIGN(LogicalExpression); | 1299 DISALLOW_COPY_AND_ASSIGN(LogicalExpression); |
1425 }; | 1300 }; |
1426 | 1301 |
1427 | 1302 |
1428 class ConditionalExpression : public Expression { | 1303 class ConditionalExpression : public Expression { |
1429 public: | 1304 public: |
1430 static ConditionalExpression* ReadFrom(Reader* reader); | 1305 static ConditionalExpression* ReadFrom(Reader* reader); |
1431 | 1306 |
1432 virtual ~ConditionalExpression(); | 1307 virtual ~ConditionalExpression(); |
1433 | 1308 |
1434 DEFINE_CASTING_OPERATIONS(ConditionalExpression); | 1309 DEFINE_CASTING_OPERATIONS(ConditionalExpression); |
1435 | 1310 |
1436 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1311 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1437 virtual void VisitChildren(Visitor* visitor); | |
1438 | 1312 |
1439 Expression* condition() { return condition_; } | 1313 Expression* condition() { return condition_; } |
1440 Expression* then() { return then_; } | 1314 Expression* then() { return then_; } |
1441 Expression* otherwise() { return otherwise_; } | 1315 Expression* otherwise() { return otherwise_; } |
1442 | 1316 |
1443 private: | 1317 private: |
1444 ConditionalExpression() {} | 1318 ConditionalExpression() {} |
1445 | 1319 |
1446 Child<Expression> condition_; | 1320 Child<Expression> condition_; |
1447 Child<Expression> then_; | 1321 Child<Expression> then_; |
1448 Child<Expression> otherwise_; | 1322 Child<Expression> otherwise_; |
1449 | 1323 |
1450 DISALLOW_COPY_AND_ASSIGN(ConditionalExpression); | 1324 DISALLOW_COPY_AND_ASSIGN(ConditionalExpression); |
1451 }; | 1325 }; |
1452 | 1326 |
1453 | 1327 |
1454 class StringConcatenation : public Expression { | 1328 class StringConcatenation : public Expression { |
1455 public: | 1329 public: |
1456 static StringConcatenation* ReadFrom(Reader* reader); | 1330 static StringConcatenation* ReadFrom(Reader* reader); |
1457 | 1331 |
1458 virtual ~StringConcatenation(); | 1332 virtual ~StringConcatenation(); |
1459 | 1333 |
1460 DEFINE_CASTING_OPERATIONS(StringConcatenation); | 1334 DEFINE_CASTING_OPERATIONS(StringConcatenation); |
1461 | 1335 |
1462 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1336 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1463 virtual void VisitChildren(Visitor* visitor); | |
1464 | 1337 |
1465 List<Expression>& expressions() { return expressions_; } | 1338 List<Expression>& expressions() { return expressions_; } |
1466 | 1339 |
1467 private: | 1340 private: |
1468 StringConcatenation() {} | 1341 StringConcatenation() {} |
1469 | 1342 |
1470 List<Expression> expressions_; | 1343 List<Expression> expressions_; |
1471 | 1344 |
1472 DISALLOW_COPY_AND_ASSIGN(StringConcatenation); | 1345 DISALLOW_COPY_AND_ASSIGN(StringConcatenation); |
1473 }; | 1346 }; |
1474 | 1347 |
1475 | 1348 |
1476 class IsExpression : public Expression { | 1349 class IsExpression : public Expression { |
1477 public: | 1350 public: |
1478 static IsExpression* ReadFrom(Reader* reader); | 1351 static IsExpression* ReadFrom(Reader* reader); |
1479 | 1352 |
1480 virtual ~IsExpression(); | 1353 virtual ~IsExpression(); |
1481 | 1354 |
1482 DEFINE_CASTING_OPERATIONS(IsExpression); | 1355 DEFINE_CASTING_OPERATIONS(IsExpression); |
1483 | 1356 |
1484 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1357 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1485 virtual void VisitChildren(Visitor* visitor); | |
1486 | 1358 |
1487 Expression* operand() { return operand_; } | 1359 Expression* operand() { return operand_; } |
1488 DartType* type() { return type_; } | 1360 DartType* type() { return type_; } |
1489 | 1361 |
1490 private: | 1362 private: |
1491 IsExpression() {} | 1363 IsExpression() {} |
1492 | 1364 |
1493 Child<Expression> operand_; | 1365 Child<Expression> operand_; |
1494 Child<DartType> type_; | 1366 Child<DartType> type_; |
1495 | 1367 |
1496 DISALLOW_COPY_AND_ASSIGN(IsExpression); | 1368 DISALLOW_COPY_AND_ASSIGN(IsExpression); |
1497 }; | 1369 }; |
1498 | 1370 |
1499 | 1371 |
1500 class AsExpression : public Expression { | 1372 class AsExpression : public Expression { |
1501 public: | 1373 public: |
1502 static AsExpression* ReadFrom(Reader* reader); | 1374 static AsExpression* ReadFrom(Reader* reader); |
1503 | 1375 |
1504 virtual ~AsExpression(); | 1376 virtual ~AsExpression(); |
1505 | 1377 |
1506 DEFINE_CASTING_OPERATIONS(AsExpression); | 1378 DEFINE_CASTING_OPERATIONS(AsExpression); |
1507 | 1379 |
1508 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1380 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1509 virtual void VisitChildren(Visitor* visitor); | |
1510 | 1381 |
1511 Expression* operand() { return operand_; } | 1382 Expression* operand() { return operand_; } |
1512 DartType* type() { return type_; } | 1383 DartType* type() { return type_; } |
1513 | 1384 |
1514 private: | 1385 private: |
1515 AsExpression() {} | 1386 AsExpression() {} |
1516 | 1387 |
1517 Child<Expression> operand_; | 1388 Child<Expression> operand_; |
1518 Child<DartType> type_; | 1389 Child<DartType> type_; |
1519 | 1390 |
1520 DISALLOW_COPY_AND_ASSIGN(AsExpression); | 1391 DISALLOW_COPY_AND_ASSIGN(AsExpression); |
1521 }; | 1392 }; |
1522 | 1393 |
1523 | 1394 |
1524 class BasicLiteral : public Expression { | 1395 class BasicLiteral : public Expression { |
1525 public: | 1396 public: |
1526 virtual ~BasicLiteral(); | 1397 virtual ~BasicLiteral(); |
1527 | 1398 |
1528 DEFINE_CASTING_OPERATIONS(BasicLiteral); | 1399 DEFINE_CASTING_OPERATIONS(BasicLiteral); |
1529 | |
1530 virtual void VisitChildren(Visitor* visitor); | |
1531 }; | 1400 }; |
1532 | 1401 |
1533 | 1402 |
1534 class StringLiteral : public BasicLiteral { | 1403 class StringLiteral : public BasicLiteral { |
1535 public: | 1404 public: |
1536 static StringLiteral* ReadFrom(Reader* reader); | 1405 static StringLiteral* ReadFrom(Reader* reader); |
1537 | 1406 |
1538 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1407 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1539 | 1408 |
1540 explicit StringLiteral(StringIndex string_index) | 1409 explicit StringLiteral(StringIndex string_index) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 | 1526 |
1658 class SymbolLiteral : public Expression { | 1527 class SymbolLiteral : public Expression { |
1659 public: | 1528 public: |
1660 static SymbolLiteral* ReadFrom(Reader* reader); | 1529 static SymbolLiteral* ReadFrom(Reader* reader); |
1661 | 1530 |
1662 virtual ~SymbolLiteral(); | 1531 virtual ~SymbolLiteral(); |
1663 | 1532 |
1664 DEFINE_CASTING_OPERATIONS(SymbolLiteral); | 1533 DEFINE_CASTING_OPERATIONS(SymbolLiteral); |
1665 | 1534 |
1666 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1535 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1667 virtual void VisitChildren(Visitor* visitor); | |
1668 | 1536 |
1669 StringIndex value() { return value_index_; } | 1537 StringIndex value() { return value_index_; } |
1670 | 1538 |
1671 private: | 1539 private: |
1672 SymbolLiteral() {} | 1540 SymbolLiteral() {} |
1673 | 1541 |
1674 StringIndex value_index_; | 1542 StringIndex value_index_; |
1675 | 1543 |
1676 DISALLOW_COPY_AND_ASSIGN(SymbolLiteral); | 1544 DISALLOW_COPY_AND_ASSIGN(SymbolLiteral); |
1677 }; | 1545 }; |
1678 | 1546 |
1679 | 1547 |
1680 class TypeLiteral : public Expression { | 1548 class TypeLiteral : public Expression { |
1681 public: | 1549 public: |
1682 static TypeLiteral* ReadFrom(Reader* reader); | 1550 static TypeLiteral* ReadFrom(Reader* reader); |
1683 | 1551 |
1684 virtual ~TypeLiteral(); | 1552 virtual ~TypeLiteral(); |
1685 | 1553 |
1686 DEFINE_CASTING_OPERATIONS(TypeLiteral); | 1554 DEFINE_CASTING_OPERATIONS(TypeLiteral); |
1687 | 1555 |
1688 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1556 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1689 virtual void VisitChildren(Visitor* visitor); | |
1690 | 1557 |
1691 DartType* type() { return type_; } | 1558 DartType* type() { return type_; } |
1692 | 1559 |
1693 private: | 1560 private: |
1694 TypeLiteral() {} | 1561 TypeLiteral() {} |
1695 | 1562 |
1696 Child<DartType> type_; | 1563 Child<DartType> type_; |
1697 | 1564 |
1698 DISALLOW_COPY_AND_ASSIGN(TypeLiteral); | 1565 DISALLOW_COPY_AND_ASSIGN(TypeLiteral); |
1699 }; | 1566 }; |
1700 | 1567 |
1701 | 1568 |
1702 class ThisExpression : public Expression { | 1569 class ThisExpression : public Expression { |
1703 public: | 1570 public: |
1704 static ThisExpression* ReadFrom(Reader* reader); | 1571 static ThisExpression* ReadFrom(Reader* reader); |
1705 | 1572 |
1706 virtual ~ThisExpression(); | 1573 virtual ~ThisExpression(); |
1707 | 1574 |
1708 DEFINE_CASTING_OPERATIONS(ThisExpression); | 1575 DEFINE_CASTING_OPERATIONS(ThisExpression); |
1709 | 1576 |
1710 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1577 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1711 virtual void VisitChildren(Visitor* visitor); | |
1712 | 1578 |
1713 private: | 1579 private: |
1714 ThisExpression() {} | 1580 ThisExpression() {} |
1715 | 1581 |
1716 DISALLOW_COPY_AND_ASSIGN(ThisExpression); | 1582 DISALLOW_COPY_AND_ASSIGN(ThisExpression); |
1717 }; | 1583 }; |
1718 | 1584 |
1719 | 1585 |
1720 class Rethrow : public Expression { | 1586 class Rethrow : public Expression { |
1721 public: | 1587 public: |
1722 static Rethrow* ReadFrom(Reader* reader); | 1588 static Rethrow* ReadFrom(Reader* reader); |
1723 | 1589 |
1724 virtual ~Rethrow(); | 1590 virtual ~Rethrow(); |
1725 | 1591 |
1726 DEFINE_CASTING_OPERATIONS(Rethrow); | 1592 DEFINE_CASTING_OPERATIONS(Rethrow); |
1727 | 1593 |
1728 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1594 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1729 virtual void VisitChildren(Visitor* visitor); | |
1730 | 1595 |
1731 private: | 1596 private: |
1732 Rethrow() {} | 1597 Rethrow() {} |
1733 | 1598 |
1734 DISALLOW_COPY_AND_ASSIGN(Rethrow); | 1599 DISALLOW_COPY_AND_ASSIGN(Rethrow); |
1735 }; | 1600 }; |
1736 | 1601 |
1737 | 1602 |
1738 class Throw : public Expression { | 1603 class Throw : public Expression { |
1739 public: | 1604 public: |
1740 static Throw* ReadFrom(Reader* reader); | 1605 static Throw* ReadFrom(Reader* reader); |
1741 | 1606 |
1742 virtual ~Throw(); | 1607 virtual ~Throw(); |
1743 | 1608 |
1744 DEFINE_CASTING_OPERATIONS(Throw); | 1609 DEFINE_CASTING_OPERATIONS(Throw); |
1745 | 1610 |
1746 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1611 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1747 virtual void VisitChildren(Visitor* visitor); | |
1748 | 1612 |
1749 Expression* expression() { return expression_; } | 1613 Expression* expression() { return expression_; } |
1750 | 1614 |
1751 private: | 1615 private: |
1752 Throw() {} | 1616 Throw() {} |
1753 | 1617 |
1754 Child<Expression> expression_; | 1618 Child<Expression> expression_; |
1755 | 1619 |
1756 DISALLOW_COPY_AND_ASSIGN(Throw); | 1620 DISALLOW_COPY_AND_ASSIGN(Throw); |
1757 }; | 1621 }; |
1758 | 1622 |
1759 | 1623 |
1760 class ListLiteral : public Expression { | 1624 class ListLiteral : public Expression { |
1761 public: | 1625 public: |
1762 static ListLiteral* ReadFrom(Reader* reader, bool is_const); | 1626 static ListLiteral* ReadFrom(Reader* reader, bool is_const); |
1763 | 1627 |
1764 virtual ~ListLiteral(); | 1628 virtual ~ListLiteral(); |
1765 | 1629 |
1766 DEFINE_CASTING_OPERATIONS(ListLiteral); | 1630 DEFINE_CASTING_OPERATIONS(ListLiteral); |
1767 | 1631 |
1768 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1632 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1769 virtual void VisitChildren(Visitor* visitor); | |
1770 | 1633 |
1771 bool is_const() { return is_const_; } | 1634 bool is_const() { return is_const_; } |
1772 DartType* type() { return type_; } | 1635 DartType* type() { return type_; } |
1773 List<Expression>& expressions() { return expressions_; } | 1636 List<Expression>& expressions() { return expressions_; } |
1774 | 1637 |
1775 private: | 1638 private: |
1776 ListLiteral() {} | 1639 ListLiteral() {} |
1777 | 1640 |
1778 bool is_const_; | 1641 bool is_const_; |
1779 Child<DartType> type_; | 1642 Child<DartType> type_; |
1780 List<Expression> expressions_; | 1643 List<Expression> expressions_; |
1781 | 1644 |
1782 DISALLOW_COPY_AND_ASSIGN(ListLiteral); | 1645 DISALLOW_COPY_AND_ASSIGN(ListLiteral); |
1783 }; | 1646 }; |
1784 | 1647 |
1785 | 1648 |
1786 class MapLiteral : public Expression { | 1649 class MapLiteral : public Expression { |
1787 public: | 1650 public: |
1788 static MapLiteral* ReadFrom(Reader* reader, bool is_const); | 1651 static MapLiteral* ReadFrom(Reader* reader, bool is_const); |
1789 | 1652 |
1790 virtual ~MapLiteral(); | 1653 virtual ~MapLiteral(); |
1791 | 1654 |
1792 DEFINE_CASTING_OPERATIONS(MapLiteral); | 1655 DEFINE_CASTING_OPERATIONS(MapLiteral); |
1793 | 1656 |
1794 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1657 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1795 virtual void VisitChildren(Visitor* visitor); | |
1796 | 1658 |
1797 bool is_const() { return is_const_; } | 1659 bool is_const() { return is_const_; } |
1798 DartType* key_type() { return key_type_; } | 1660 DartType* key_type() { return key_type_; } |
1799 DartType* value_type() { return value_type_; } | 1661 DartType* value_type() { return value_type_; } |
1800 List<MapEntry>& entries() { return entries_; } | 1662 List<MapEntry>& entries() { return entries_; } |
1801 | 1663 |
1802 private: | 1664 private: |
1803 MapLiteral() {} | 1665 MapLiteral() {} |
1804 | 1666 |
1805 bool is_const_; | 1667 bool is_const_; |
1806 Child<DartType> key_type_; | 1668 Child<DartType> key_type_; |
1807 Child<DartType> value_type_; | 1669 Child<DartType> value_type_; |
1808 List<MapEntry> entries_; | 1670 List<MapEntry> entries_; |
1809 | 1671 |
1810 DISALLOW_COPY_AND_ASSIGN(MapLiteral); | 1672 DISALLOW_COPY_AND_ASSIGN(MapLiteral); |
1811 }; | 1673 }; |
1812 | 1674 |
1813 | 1675 |
1814 class MapEntry : public TreeNode { | 1676 class MapEntry : public TreeNode { |
1815 public: | 1677 public: |
1816 static MapEntry* ReadFrom(Reader* reader); | 1678 static MapEntry* ReadFrom(Reader* reader); |
1817 | 1679 |
1818 virtual ~MapEntry(); | 1680 virtual ~MapEntry(); |
1819 | 1681 |
1820 DEFINE_CASTING_OPERATIONS(MapEntry); | 1682 DEFINE_CASTING_OPERATIONS(MapEntry); |
1821 | 1683 |
1822 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
1823 virtual void VisitChildren(Visitor* visitor); | |
1824 | |
1825 Expression* key() { return key_; } | 1684 Expression* key() { return key_; } |
1826 Expression* value() { return value_; } | 1685 Expression* value() { return value_; } |
1827 | 1686 |
1828 private: | 1687 private: |
1829 MapEntry() {} | 1688 MapEntry() {} |
1830 | 1689 |
1831 template <typename T> | 1690 template <typename T> |
1832 friend class List; | 1691 friend class List; |
1833 | 1692 |
1834 Child<Expression> key_; | 1693 Child<Expression> key_; |
1835 Child<Expression> value_; | 1694 Child<Expression> value_; |
1836 | 1695 |
1837 DISALLOW_COPY_AND_ASSIGN(MapEntry); | 1696 DISALLOW_COPY_AND_ASSIGN(MapEntry); |
1838 }; | 1697 }; |
1839 | 1698 |
1840 | 1699 |
1841 class AwaitExpression : public Expression { | 1700 class AwaitExpression : public Expression { |
1842 public: | 1701 public: |
1843 static AwaitExpression* ReadFrom(Reader* reader); | 1702 static AwaitExpression* ReadFrom(Reader* reader); |
1844 | 1703 |
1845 virtual ~AwaitExpression(); | 1704 virtual ~AwaitExpression(); |
1846 | 1705 |
1847 DEFINE_CASTING_OPERATIONS(AwaitExpression); | 1706 DEFINE_CASTING_OPERATIONS(AwaitExpression); |
1848 | 1707 |
1849 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1708 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1850 virtual void VisitChildren(Visitor* visitor); | |
1851 | 1709 |
1852 Expression* operand() { return operand_; } | 1710 Expression* operand() { return operand_; } |
1853 | 1711 |
1854 private: | 1712 private: |
1855 AwaitExpression() {} | 1713 AwaitExpression() {} |
1856 | 1714 |
1857 Child<Expression> operand_; | 1715 Child<Expression> operand_; |
1858 | 1716 |
1859 DISALLOW_COPY_AND_ASSIGN(AwaitExpression); | 1717 DISALLOW_COPY_AND_ASSIGN(AwaitExpression); |
1860 }; | 1718 }; |
1861 | 1719 |
1862 | 1720 |
1863 class FunctionExpression : public Expression { | 1721 class FunctionExpression : public Expression { |
1864 public: | 1722 public: |
1865 static FunctionExpression* ReadFrom(Reader* reader); | 1723 static FunctionExpression* ReadFrom(Reader* reader); |
1866 | 1724 |
1867 virtual ~FunctionExpression(); | 1725 virtual ~FunctionExpression(); |
1868 | 1726 |
1869 DEFINE_CASTING_OPERATIONS(FunctionExpression); | 1727 DEFINE_CASTING_OPERATIONS(FunctionExpression); |
1870 | 1728 |
1871 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1729 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1872 virtual void VisitChildren(Visitor* visitor); | |
1873 | 1730 |
1874 FunctionNode* function() { return function_; } | 1731 FunctionNode* function() { return function_; } |
1875 | 1732 |
1876 private: | 1733 private: |
1877 FunctionExpression() {} | 1734 FunctionExpression() {} |
1878 | 1735 |
1879 Child<FunctionNode> function_; | 1736 Child<FunctionNode> function_; |
1880 | 1737 |
1881 DISALLOW_COPY_AND_ASSIGN(FunctionExpression); | 1738 DISALLOW_COPY_AND_ASSIGN(FunctionExpression); |
1882 }; | 1739 }; |
1883 | 1740 |
1884 | 1741 |
1885 class Let : public Expression { | 1742 class Let : public Expression { |
1886 public: | 1743 public: |
1887 static Let* ReadFrom(Reader* reader); | 1744 static Let* ReadFrom(Reader* reader); |
1888 | 1745 |
1889 virtual ~Let(); | 1746 virtual ~Let(); |
1890 | 1747 |
1891 DEFINE_CASTING_OPERATIONS(Let); | 1748 DEFINE_CASTING_OPERATIONS(Let); |
1892 | 1749 |
1893 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1750 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1894 virtual void VisitChildren(Visitor* visitor); | |
1895 | 1751 |
1896 VariableDeclaration* variable() { return variable_; } | 1752 VariableDeclaration* variable() { return variable_; } |
1897 Expression* body() { return body_; } | 1753 Expression* body() { return body_; } |
1898 TokenPosition position() { return position_; } | 1754 TokenPosition position() { return position_; } |
1899 TokenPosition end_position() { return end_position_; } | 1755 TokenPosition end_position() { return end_position_; } |
1900 | 1756 |
1901 private: | 1757 private: |
1902 Let() | 1758 Let() |
1903 : position_(TokenPosition::kNoSource), | 1759 : position_(TokenPosition::kNoSource), |
1904 end_position_(TokenPosition::kNoSource) {} | 1760 end_position_(TokenPosition::kNoSource) {} |
1905 | 1761 |
1906 Child<VariableDeclaration> variable_; | 1762 Child<VariableDeclaration> variable_; |
1907 Child<Expression> body_; | 1763 Child<Expression> body_; |
1908 TokenPosition position_; | 1764 TokenPosition position_; |
1909 TokenPosition end_position_; | 1765 TokenPosition end_position_; |
1910 | 1766 |
1911 DISALLOW_COPY_AND_ASSIGN(Let); | 1767 DISALLOW_COPY_AND_ASSIGN(Let); |
1912 }; | 1768 }; |
1913 | 1769 |
1914 | 1770 |
1915 class VectorCreation : public Expression { | 1771 class VectorCreation : public Expression { |
1916 public: | 1772 public: |
1917 static VectorCreation* ReadFrom(Reader* reader); | 1773 static VectorCreation* ReadFrom(Reader* reader); |
1918 | 1774 |
1919 virtual ~VectorCreation(); | 1775 virtual ~VectorCreation(); |
1920 | 1776 |
1921 DEFINE_CASTING_OPERATIONS(VectorCreation); | 1777 DEFINE_CASTING_OPERATIONS(VectorCreation); |
1922 | 1778 |
1923 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1779 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1924 virtual void VisitChildren(Visitor* visitor); | |
1925 | 1780 |
1926 intptr_t value() { return value_; } | 1781 intptr_t value() { return value_; } |
1927 | 1782 |
1928 private: | 1783 private: |
1929 VectorCreation() {} | 1784 VectorCreation() {} |
1930 | 1785 |
1931 intptr_t value_; | 1786 intptr_t value_; |
1932 | 1787 |
1933 DISALLOW_COPY_AND_ASSIGN(VectorCreation); | 1788 DISALLOW_COPY_AND_ASSIGN(VectorCreation); |
1934 }; | 1789 }; |
1935 | 1790 |
1936 | 1791 |
1937 class VectorGet : public Expression { | 1792 class VectorGet : public Expression { |
1938 public: | 1793 public: |
1939 static VectorGet* ReadFrom(Reader* reader); | 1794 static VectorGet* ReadFrom(Reader* reader); |
1940 | 1795 |
1941 virtual ~VectorGet(); | 1796 virtual ~VectorGet(); |
1942 | 1797 |
1943 DEFINE_CASTING_OPERATIONS(VectorGet); | 1798 DEFINE_CASTING_OPERATIONS(VectorGet); |
1944 | 1799 |
1945 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1800 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1946 virtual void VisitChildren(Visitor* visitor); | |
1947 | 1801 |
1948 Expression* vector_expression() { return vector_expression_; } | 1802 Expression* vector_expression() { return vector_expression_; } |
1949 intptr_t index() { return index_; } | 1803 intptr_t index() { return index_; } |
1950 | 1804 |
1951 private: | 1805 private: |
1952 VectorGet() {} | 1806 VectorGet() {} |
1953 | 1807 |
1954 Child<Expression> vector_expression_; | 1808 Child<Expression> vector_expression_; |
1955 intptr_t index_; | 1809 intptr_t index_; |
1956 | 1810 |
1957 DISALLOW_COPY_AND_ASSIGN(VectorGet); | 1811 DISALLOW_COPY_AND_ASSIGN(VectorGet); |
1958 }; | 1812 }; |
1959 | 1813 |
1960 | 1814 |
1961 class VectorSet : public Expression { | 1815 class VectorSet : public Expression { |
1962 public: | 1816 public: |
1963 static VectorSet* ReadFrom(Reader* reader); | 1817 static VectorSet* ReadFrom(Reader* reader); |
1964 | 1818 |
1965 virtual ~VectorSet(); | 1819 virtual ~VectorSet(); |
1966 | 1820 |
1967 DEFINE_CASTING_OPERATIONS(VectorSet); | 1821 DEFINE_CASTING_OPERATIONS(VectorSet); |
1968 | 1822 |
1969 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1823 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1970 virtual void VisitChildren(Visitor* visitor); | |
1971 | 1824 |
1972 Expression* vector_expression() { return vector_expression_; } | 1825 Expression* vector_expression() { return vector_expression_; } |
1973 intptr_t index() { return index_; } | 1826 intptr_t index() { return index_; } |
1974 Expression* value() { return value_; } | 1827 Expression* value() { return value_; } |
1975 | 1828 |
1976 private: | 1829 private: |
1977 VectorSet() {} | 1830 VectorSet() {} |
1978 | 1831 |
1979 Child<Expression> vector_expression_; | 1832 Child<Expression> vector_expression_; |
1980 intptr_t index_; | 1833 intptr_t index_; |
1981 Child<Expression> value_; | 1834 Child<Expression> value_; |
1982 | 1835 |
1983 DISALLOW_COPY_AND_ASSIGN(VectorSet); | 1836 DISALLOW_COPY_AND_ASSIGN(VectorSet); |
1984 }; | 1837 }; |
1985 | 1838 |
1986 | 1839 |
1987 class VectorCopy : public Expression { | 1840 class VectorCopy : public Expression { |
1988 public: | 1841 public: |
1989 static VectorCopy* ReadFrom(Reader* reader); | 1842 static VectorCopy* ReadFrom(Reader* reader); |
1990 | 1843 |
1991 virtual ~VectorCopy(); | 1844 virtual ~VectorCopy(); |
1992 | 1845 |
1993 DEFINE_CASTING_OPERATIONS(VectorCopy); | 1846 DEFINE_CASTING_OPERATIONS(VectorCopy); |
1994 | 1847 |
1995 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1848 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1996 virtual void VisitChildren(Visitor* visitor); | |
1997 | 1849 |
1998 Expression* vector_expression() { return vector_expression_; } | 1850 Expression* vector_expression() { return vector_expression_; } |
1999 | 1851 |
2000 private: | 1852 private: |
2001 VectorCopy() {} | 1853 VectorCopy() {} |
2002 | 1854 |
2003 Child<Expression> vector_expression_; | 1855 Child<Expression> vector_expression_; |
2004 | 1856 |
2005 DISALLOW_COPY_AND_ASSIGN(VectorCopy); | 1857 DISALLOW_COPY_AND_ASSIGN(VectorCopy); |
2006 }; | 1858 }; |
2007 | 1859 |
2008 | 1860 |
2009 class ClosureCreation : public Expression { | 1861 class ClosureCreation : public Expression { |
2010 public: | 1862 public: |
2011 static ClosureCreation* ReadFrom(Reader* reader); | 1863 static ClosureCreation* ReadFrom(Reader* reader); |
2012 | 1864 |
2013 virtual ~ClosureCreation(); | 1865 virtual ~ClosureCreation(); |
2014 | 1866 |
2015 DEFINE_CASTING_OPERATIONS(ClosureCreation); | 1867 DEFINE_CASTING_OPERATIONS(ClosureCreation); |
2016 | 1868 |
2017 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1869 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
2018 virtual void VisitChildren(Visitor* visitor); | |
2019 | 1870 |
2020 NameIndex top_level_function() { return top_level_function_reference_; } | 1871 NameIndex top_level_function() { return top_level_function_reference_; } |
2021 Expression* context_vector() { return context_vector_; } | 1872 Expression* context_vector() { return context_vector_; } |
2022 FunctionType* function_type() { return function_type_; } | 1873 FunctionType* function_type() { return function_type_; } |
2023 | 1874 |
2024 private: | 1875 private: |
2025 ClosureCreation() {} | 1876 ClosureCreation() {} |
2026 | 1877 |
2027 NameIndex top_level_function_reference_; // Procedure canonical name. | 1878 NameIndex top_level_function_reference_; // Procedure canonical name. |
2028 Child<Expression> context_vector_; | 1879 Child<Expression> context_vector_; |
2029 Child<FunctionType> function_type_; | 1880 Child<FunctionType> function_type_; |
2030 | 1881 |
2031 DISALLOW_COPY_AND_ASSIGN(ClosureCreation); | 1882 DISALLOW_COPY_AND_ASSIGN(ClosureCreation); |
2032 }; | 1883 }; |
2033 | 1884 |
2034 | 1885 |
2035 class Statement : public TreeNode { | 1886 class Statement : public TreeNode { |
2036 public: | 1887 public: |
2037 static Statement* ReadFrom(Reader* reader); | 1888 static Statement* ReadFrom(Reader* reader); |
2038 | 1889 |
2039 virtual ~Statement(); | 1890 virtual ~Statement(); |
2040 | 1891 |
2041 DEFINE_CASTING_OPERATIONS(Statement); | 1892 DEFINE_CASTING_OPERATIONS(Statement); |
2042 | 1893 |
2043 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
2044 virtual void AcceptStatementVisitor(StatementVisitor* visitor) = 0; | |
2045 TokenPosition position() { return position_; } | 1894 TokenPosition position() { return position_; } |
2046 | 1895 |
2047 protected: | 1896 protected: |
2048 Statement() : position_(TokenPosition::kNoSource) {} | 1897 Statement() : position_(TokenPosition::kNoSource) {} |
2049 TokenPosition position_; | 1898 TokenPosition position_; |
2050 | 1899 |
2051 private: | 1900 private: |
2052 DISALLOW_COPY_AND_ASSIGN(Statement); | 1901 DISALLOW_COPY_AND_ASSIGN(Statement); |
2053 }; | 1902 }; |
2054 | 1903 |
2055 | 1904 |
2056 class InvalidStatement : public Statement { | 1905 class InvalidStatement : public Statement { |
2057 public: | 1906 public: |
2058 static InvalidStatement* ReadFrom(Reader* reader); | 1907 static InvalidStatement* ReadFrom(Reader* reader); |
2059 | 1908 |
2060 virtual ~InvalidStatement(); | 1909 virtual ~InvalidStatement(); |
2061 | 1910 |
2062 DEFINE_CASTING_OPERATIONS(InvalidStatement); | 1911 DEFINE_CASTING_OPERATIONS(InvalidStatement); |
2063 | 1912 |
2064 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2065 virtual void VisitChildren(Visitor* visitor); | |
2066 | |
2067 private: | 1913 private: |
2068 InvalidStatement() {} | 1914 InvalidStatement() {} |
2069 | 1915 |
2070 DISALLOW_COPY_AND_ASSIGN(InvalidStatement); | 1916 DISALLOW_COPY_AND_ASSIGN(InvalidStatement); |
2071 }; | 1917 }; |
2072 | 1918 |
2073 | 1919 |
2074 class ExpressionStatement : public Statement { | 1920 class ExpressionStatement : public Statement { |
2075 public: | 1921 public: |
2076 static ExpressionStatement* ReadFrom(Reader* reader); | 1922 static ExpressionStatement* ReadFrom(Reader* reader); |
2077 | 1923 |
2078 explicit ExpressionStatement(Expression* exp) : expression_(exp) {} | 1924 explicit ExpressionStatement(Expression* exp) : expression_(exp) {} |
2079 virtual ~ExpressionStatement(); | 1925 virtual ~ExpressionStatement(); |
2080 | 1926 |
2081 DEFINE_CASTING_OPERATIONS(ExpressionStatement); | 1927 DEFINE_CASTING_OPERATIONS(ExpressionStatement); |
2082 | 1928 |
2083 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2084 virtual void VisitChildren(Visitor* visitor); | |
2085 | |
2086 Expression* expression() { return expression_; } | 1929 Expression* expression() { return expression_; } |
2087 | 1930 |
2088 private: | 1931 private: |
2089 ExpressionStatement() {} | 1932 ExpressionStatement() {} |
2090 | 1933 |
2091 Child<Expression> expression_; | 1934 Child<Expression> expression_; |
2092 | 1935 |
2093 DISALLOW_COPY_AND_ASSIGN(ExpressionStatement); | 1936 DISALLOW_COPY_AND_ASSIGN(ExpressionStatement); |
2094 }; | 1937 }; |
2095 | 1938 |
2096 | 1939 |
2097 class Block : public Statement { | 1940 class Block : public Statement { |
2098 public: | 1941 public: |
2099 static Block* ReadFromImpl(Reader* reader); | 1942 static Block* ReadFromImpl(Reader* reader); |
2100 | 1943 |
2101 virtual ~Block(); | 1944 virtual ~Block(); |
2102 | 1945 |
2103 DEFINE_CASTING_OPERATIONS(Block); | 1946 DEFINE_CASTING_OPERATIONS(Block); |
2104 | 1947 |
2105 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2106 virtual void VisitChildren(Visitor* visitor); | |
2107 | |
2108 List<Statement>& statements() { return statements_; } | 1948 List<Statement>& statements() { return statements_; } |
2109 TokenPosition end_position() { return end_position_; } | 1949 TokenPosition end_position() { return end_position_; } |
2110 | 1950 |
2111 private: | 1951 private: |
2112 Block() : end_position_(TokenPosition::kNoSource) {} | 1952 Block() : end_position_(TokenPosition::kNoSource) {} |
2113 | 1953 |
2114 List<Statement> statements_; | 1954 List<Statement> statements_; |
2115 TokenPosition end_position_; | 1955 TokenPosition end_position_; |
2116 | 1956 |
2117 DISALLOW_COPY_AND_ASSIGN(Block); | 1957 DISALLOW_COPY_AND_ASSIGN(Block); |
2118 }; | 1958 }; |
2119 | 1959 |
2120 | 1960 |
2121 class EmptyStatement : public Statement { | 1961 class EmptyStatement : public Statement { |
2122 public: | 1962 public: |
2123 static EmptyStatement* ReadFrom(Reader* reader); | 1963 static EmptyStatement* ReadFrom(Reader* reader); |
2124 | 1964 |
2125 virtual ~EmptyStatement(); | 1965 virtual ~EmptyStatement(); |
2126 | 1966 |
2127 DEFINE_CASTING_OPERATIONS(EmptyStatement); | 1967 DEFINE_CASTING_OPERATIONS(EmptyStatement); |
2128 | 1968 |
2129 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2130 virtual void VisitChildren(Visitor* visitor); | |
2131 | |
2132 private: | 1969 private: |
2133 EmptyStatement() {} | 1970 EmptyStatement() {} |
2134 | 1971 |
2135 DISALLOW_COPY_AND_ASSIGN(EmptyStatement); | 1972 DISALLOW_COPY_AND_ASSIGN(EmptyStatement); |
2136 }; | 1973 }; |
2137 | 1974 |
2138 | 1975 |
2139 class AssertStatement : public Statement { | 1976 class AssertStatement : public Statement { |
2140 public: | 1977 public: |
2141 static AssertStatement* ReadFrom(Reader* reader); | 1978 static AssertStatement* ReadFrom(Reader* reader); |
2142 | 1979 |
2143 virtual ~AssertStatement(); | 1980 virtual ~AssertStatement(); |
2144 | 1981 |
2145 DEFINE_CASTING_OPERATIONS(AssertStatement); | 1982 DEFINE_CASTING_OPERATIONS(AssertStatement); |
2146 | 1983 |
2147 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2148 virtual void VisitChildren(Visitor* visitor); | |
2149 | |
2150 Expression* condition() { return condition_; } | 1984 Expression* condition() { return condition_; } |
2151 Expression* message() { return message_; } | 1985 Expression* message() { return message_; } |
2152 | 1986 |
2153 private: | 1987 private: |
2154 AssertStatement() {} | 1988 AssertStatement() {} |
2155 | 1989 |
2156 Child<Expression> condition_; | 1990 Child<Expression> condition_; |
2157 Child<Expression> message_; | 1991 Child<Expression> message_; |
2158 | 1992 |
2159 DISALLOW_COPY_AND_ASSIGN(AssertStatement); | 1993 DISALLOW_COPY_AND_ASSIGN(AssertStatement); |
2160 }; | 1994 }; |
2161 | 1995 |
2162 | 1996 |
2163 class LabeledStatement : public Statement { | 1997 class LabeledStatement : public Statement { |
2164 public: | 1998 public: |
2165 static LabeledStatement* ReadFrom(Reader* reader); | 1999 static LabeledStatement* ReadFrom(Reader* reader); |
2166 | 2000 |
2167 virtual ~LabeledStatement(); | 2001 virtual ~LabeledStatement(); |
2168 | 2002 |
2169 DEFINE_CASTING_OPERATIONS(LabeledStatement); | 2003 DEFINE_CASTING_OPERATIONS(LabeledStatement); |
2170 | 2004 |
2171 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2172 virtual void VisitChildren(Visitor* visitor); | |
2173 | |
2174 Statement* body() { return body_; } | 2005 Statement* body() { return body_; } |
2175 | 2006 |
2176 private: | 2007 private: |
2177 LabeledStatement() {} | 2008 LabeledStatement() {} |
2178 | 2009 |
2179 Child<Statement> body_; | 2010 Child<Statement> body_; |
2180 | 2011 |
2181 DISALLOW_COPY_AND_ASSIGN(LabeledStatement); | 2012 DISALLOW_COPY_AND_ASSIGN(LabeledStatement); |
2182 }; | 2013 }; |
2183 | 2014 |
2184 | 2015 |
2185 class BreakStatement : public Statement { | 2016 class BreakStatement : public Statement { |
2186 public: | 2017 public: |
2187 static BreakStatement* ReadFrom(Reader* reader); | 2018 static BreakStatement* ReadFrom(Reader* reader); |
2188 | 2019 |
2189 virtual ~BreakStatement(); | 2020 virtual ~BreakStatement(); |
2190 | 2021 |
2191 DEFINE_CASTING_OPERATIONS(BreakStatement); | 2022 DEFINE_CASTING_OPERATIONS(BreakStatement); |
2192 | 2023 |
2193 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2194 virtual void VisitChildren(Visitor* visitor); | |
2195 | |
2196 intptr_t target_index() { return target_index_; } | 2024 intptr_t target_index() { return target_index_; } |
2197 | 2025 |
2198 private: | 2026 private: |
2199 BreakStatement() {} | 2027 BreakStatement() {} |
2200 | 2028 |
2201 intptr_t target_index_; | 2029 intptr_t target_index_; |
2202 | 2030 |
2203 DISALLOW_COPY_AND_ASSIGN(BreakStatement); | 2031 DISALLOW_COPY_AND_ASSIGN(BreakStatement); |
2204 }; | 2032 }; |
2205 | 2033 |
2206 | 2034 |
2207 class WhileStatement : public Statement { | 2035 class WhileStatement : public Statement { |
2208 public: | 2036 public: |
2209 static WhileStatement* ReadFrom(Reader* reader); | 2037 static WhileStatement* ReadFrom(Reader* reader); |
2210 | 2038 |
2211 virtual ~WhileStatement(); | 2039 virtual ~WhileStatement(); |
2212 | 2040 |
2213 DEFINE_CASTING_OPERATIONS(WhileStatement); | 2041 DEFINE_CASTING_OPERATIONS(WhileStatement); |
2214 | 2042 |
2215 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2216 virtual void VisitChildren(Visitor* visitor); | |
2217 | |
2218 Expression* condition() { return condition_; } | 2043 Expression* condition() { return condition_; } |
2219 Statement* body() { return body_; } | 2044 Statement* body() { return body_; } |
2220 | 2045 |
2221 private: | 2046 private: |
2222 WhileStatement() {} | 2047 WhileStatement() {} |
2223 | 2048 |
2224 Child<Expression> condition_; | 2049 Child<Expression> condition_; |
2225 Child<Statement> body_; | 2050 Child<Statement> body_; |
2226 | 2051 |
2227 DISALLOW_COPY_AND_ASSIGN(WhileStatement); | 2052 DISALLOW_COPY_AND_ASSIGN(WhileStatement); |
2228 }; | 2053 }; |
2229 | 2054 |
2230 | 2055 |
2231 class DoStatement : public Statement { | 2056 class DoStatement : public Statement { |
2232 public: | 2057 public: |
2233 static DoStatement* ReadFrom(Reader* reader); | 2058 static DoStatement* ReadFrom(Reader* reader); |
2234 | 2059 |
2235 virtual ~DoStatement(); | 2060 virtual ~DoStatement(); |
2236 | 2061 |
2237 DEFINE_CASTING_OPERATIONS(DoStatement); | 2062 DEFINE_CASTING_OPERATIONS(DoStatement); |
2238 | 2063 |
2239 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2240 virtual void VisitChildren(Visitor* visitor); | |
2241 | |
2242 Expression* condition() { return condition_; } | 2064 Expression* condition() { return condition_; } |
2243 Statement* body() { return body_; } | 2065 Statement* body() { return body_; } |
2244 | 2066 |
2245 private: | 2067 private: |
2246 DoStatement() {} | 2068 DoStatement() {} |
2247 | 2069 |
2248 Child<Expression> condition_; | 2070 Child<Expression> condition_; |
2249 Child<Statement> body_; | 2071 Child<Statement> body_; |
2250 | 2072 |
2251 DISALLOW_COPY_AND_ASSIGN(DoStatement); | 2073 DISALLOW_COPY_AND_ASSIGN(DoStatement); |
2252 }; | 2074 }; |
2253 | 2075 |
2254 | 2076 |
2255 class ForStatement : public Statement { | 2077 class ForStatement : public Statement { |
2256 public: | 2078 public: |
2257 static ForStatement* ReadFrom(Reader* reader); | 2079 static ForStatement* ReadFrom(Reader* reader); |
2258 | 2080 |
2259 virtual ~ForStatement(); | 2081 virtual ~ForStatement(); |
2260 | 2082 |
2261 DEFINE_CASTING_OPERATIONS(ForStatement); | 2083 DEFINE_CASTING_OPERATIONS(ForStatement); |
2262 | 2084 |
2263 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2264 virtual void VisitChildren(Visitor* visitor); | |
2265 | |
2266 List<VariableDeclaration>& variables() { return variables_; } | 2085 List<VariableDeclaration>& variables() { return variables_; } |
2267 Expression* condition() { return condition_; } | 2086 Expression* condition() { return condition_; } |
2268 List<Expression>& updates() { return updates_; } | 2087 List<Expression>& updates() { return updates_; } |
2269 Statement* body() { return body_; } | 2088 Statement* body() { return body_; } |
2270 TokenPosition position() { return position_; } | 2089 TokenPosition position() { return position_; } |
2271 TokenPosition end_position() { return end_position_; } | 2090 TokenPosition end_position() { return end_position_; } |
2272 | 2091 |
2273 private: | 2092 private: |
2274 ForStatement() | 2093 ForStatement() |
2275 : position_(TokenPosition::kNoSource), | 2094 : position_(TokenPosition::kNoSource), |
(...skipping 11 matching lines...) Expand all Loading... |
2287 | 2106 |
2288 | 2107 |
2289 class ForInStatement : public Statement { | 2108 class ForInStatement : public Statement { |
2290 public: | 2109 public: |
2291 static ForInStatement* ReadFrom(Reader* reader, bool is_async); | 2110 static ForInStatement* ReadFrom(Reader* reader, bool is_async); |
2292 | 2111 |
2293 virtual ~ForInStatement(); | 2112 virtual ~ForInStatement(); |
2294 | 2113 |
2295 DEFINE_CASTING_OPERATIONS(ForInStatement); | 2114 DEFINE_CASTING_OPERATIONS(ForInStatement); |
2296 | 2115 |
2297 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2298 virtual void VisitChildren(Visitor* visitor); | |
2299 | |
2300 VariableDeclaration* variable() { return variable_; } | 2116 VariableDeclaration* variable() { return variable_; } |
2301 Expression* iterable() { return iterable_; } | 2117 Expression* iterable() { return iterable_; } |
2302 Statement* body() { return body_; } | 2118 Statement* body() { return body_; } |
2303 bool is_async() { return is_async_; } | 2119 bool is_async() { return is_async_; } |
2304 TokenPosition position() { return position_; } | 2120 TokenPosition position() { return position_; } |
2305 TokenPosition end_position() { return end_position_; } | 2121 TokenPosition end_position() { return end_position_; } |
2306 | 2122 |
2307 private: | 2123 private: |
2308 ForInStatement() | 2124 ForInStatement() |
2309 : position_(TokenPosition::kNoSource), | 2125 : position_(TokenPosition::kNoSource), |
(...skipping 11 matching lines...) Expand all Loading... |
2321 | 2137 |
2322 | 2138 |
2323 class SwitchStatement : public Statement { | 2139 class SwitchStatement : public Statement { |
2324 public: | 2140 public: |
2325 static SwitchStatement* ReadFrom(Reader* reader); | 2141 static SwitchStatement* ReadFrom(Reader* reader); |
2326 | 2142 |
2327 virtual ~SwitchStatement(); | 2143 virtual ~SwitchStatement(); |
2328 | 2144 |
2329 DEFINE_CASTING_OPERATIONS(SwitchStatement); | 2145 DEFINE_CASTING_OPERATIONS(SwitchStatement); |
2330 | 2146 |
2331 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2332 virtual void VisitChildren(Visitor* visitor); | |
2333 | |
2334 Expression* condition() { return condition_; } | 2147 Expression* condition() { return condition_; } |
2335 List<SwitchCase>& cases() { return cases_; } | 2148 List<SwitchCase>& cases() { return cases_; } |
2336 | 2149 |
2337 private: | 2150 private: |
2338 SwitchStatement() {} | 2151 SwitchStatement() {} |
2339 | 2152 |
2340 Child<Expression> condition_; | 2153 Child<Expression> condition_; |
2341 List<SwitchCase> cases_; | 2154 List<SwitchCase> cases_; |
2342 | 2155 |
2343 DISALLOW_COPY_AND_ASSIGN(SwitchStatement); | 2156 DISALLOW_COPY_AND_ASSIGN(SwitchStatement); |
2344 }; | 2157 }; |
2345 | 2158 |
2346 | 2159 |
2347 class SwitchCase : public TreeNode { | 2160 class SwitchCase : public TreeNode { |
2348 public: | 2161 public: |
2349 SwitchCase* ReadFrom(Reader* reader); | 2162 SwitchCase* ReadFrom(Reader* reader); |
2350 | 2163 |
2351 virtual ~SwitchCase(); | 2164 virtual ~SwitchCase(); |
2352 | 2165 |
2353 DEFINE_CASTING_OPERATIONS(SwitchCase); | 2166 DEFINE_CASTING_OPERATIONS(SwitchCase); |
2354 | 2167 |
2355 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
2356 virtual void VisitChildren(Visitor* visitor); | |
2357 | |
2358 List<Expression>& expressions() { return expressions_; } | 2168 List<Expression>& expressions() { return expressions_; } |
2359 bool is_default() { return is_default_; } | 2169 bool is_default() { return is_default_; } |
2360 Statement* body() { return body_; } | 2170 Statement* body() { return body_; } |
2361 | 2171 |
2362 private: | 2172 private: |
2363 SwitchCase() {} | 2173 SwitchCase() {} |
2364 | 2174 |
2365 template <typename T> | 2175 template <typename T> |
2366 friend class List; | 2176 friend class List; |
2367 | 2177 |
2368 List<Expression> expressions_; | 2178 List<Expression> expressions_; |
2369 bool is_default_; | 2179 bool is_default_; |
2370 Child<Statement> body_; | 2180 Child<Statement> body_; |
2371 | 2181 |
2372 DISALLOW_COPY_AND_ASSIGN(SwitchCase); | 2182 DISALLOW_COPY_AND_ASSIGN(SwitchCase); |
2373 }; | 2183 }; |
2374 | 2184 |
2375 | 2185 |
2376 class ContinueSwitchStatement : public Statement { | 2186 class ContinueSwitchStatement : public Statement { |
2377 public: | 2187 public: |
2378 static ContinueSwitchStatement* ReadFrom(Reader* reader); | 2188 static ContinueSwitchStatement* ReadFrom(Reader* reader); |
2379 | 2189 |
2380 virtual ~ContinueSwitchStatement(); | 2190 virtual ~ContinueSwitchStatement(); |
2381 | 2191 |
2382 DEFINE_CASTING_OPERATIONS(ContinueSwitchStatement); | 2192 DEFINE_CASTING_OPERATIONS(ContinueSwitchStatement); |
2383 | 2193 |
2384 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2385 virtual void VisitChildren(Visitor* visitor); | |
2386 | |
2387 intptr_t target_index() { return target_index_; } | 2194 intptr_t target_index() { return target_index_; } |
2388 | 2195 |
2389 private: | 2196 private: |
2390 ContinueSwitchStatement() {} | 2197 ContinueSwitchStatement() {} |
2391 | 2198 |
2392 intptr_t target_index_; | 2199 intptr_t target_index_; |
2393 | 2200 |
2394 DISALLOW_COPY_AND_ASSIGN(ContinueSwitchStatement); | 2201 DISALLOW_COPY_AND_ASSIGN(ContinueSwitchStatement); |
2395 }; | 2202 }; |
2396 | 2203 |
2397 | 2204 |
2398 class IfStatement : public Statement { | 2205 class IfStatement : public Statement { |
2399 public: | 2206 public: |
2400 static IfStatement* ReadFrom(Reader* reader); | 2207 static IfStatement* ReadFrom(Reader* reader); |
2401 | 2208 |
2402 virtual ~IfStatement(); | 2209 virtual ~IfStatement(); |
2403 | 2210 |
2404 DEFINE_CASTING_OPERATIONS(IfStatement); | 2211 DEFINE_CASTING_OPERATIONS(IfStatement); |
2405 | 2212 |
2406 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2407 virtual void VisitChildren(Visitor* visitor); | |
2408 | |
2409 Expression* condition() { return condition_; } | 2213 Expression* condition() { return condition_; } |
2410 Statement* then() { return then_; } | 2214 Statement* then() { return then_; } |
2411 Statement* otherwise() { return otherwise_; } | 2215 Statement* otherwise() { return otherwise_; } |
2412 | 2216 |
2413 private: | 2217 private: |
2414 IfStatement() {} | 2218 IfStatement() {} |
2415 | 2219 |
2416 Child<Expression> condition_; | 2220 Child<Expression> condition_; |
2417 Child<Statement> then_; | 2221 Child<Statement> then_; |
2418 Child<Statement> otherwise_; | 2222 Child<Statement> otherwise_; |
2419 | 2223 |
2420 DISALLOW_COPY_AND_ASSIGN(IfStatement); | 2224 DISALLOW_COPY_AND_ASSIGN(IfStatement); |
2421 }; | 2225 }; |
2422 | 2226 |
2423 | 2227 |
2424 class ReturnStatement : public Statement { | 2228 class ReturnStatement : public Statement { |
2425 public: | 2229 public: |
2426 ReturnStatement(Expression* expression, bool can_stream) | |
2427 : expression_(expression) { | |
2428 can_stream_ = can_stream; | |
2429 } | |
2430 | |
2431 static ReturnStatement* ReadFrom(Reader* reader); | 2230 static ReturnStatement* ReadFrom(Reader* reader); |
2432 | 2231 |
2433 virtual ~ReturnStatement(); | 2232 virtual ~ReturnStatement(); |
2434 | 2233 |
2435 DEFINE_CASTING_OPERATIONS(ReturnStatement); | 2234 DEFINE_CASTING_OPERATIONS(ReturnStatement); |
2436 | 2235 |
2437 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2438 virtual void VisitChildren(Visitor* visitor); | |
2439 | |
2440 Expression* expression() { return expression_; } | 2236 Expression* expression() { return expression_; } |
2441 | 2237 |
2442 private: | 2238 private: |
2443 ReturnStatement() {} | 2239 ReturnStatement() {} |
2444 | 2240 |
2445 Child<Expression> expression_; | 2241 Child<Expression> expression_; |
2446 | 2242 |
2447 DISALLOW_COPY_AND_ASSIGN(ReturnStatement); | 2243 DISALLOW_COPY_AND_ASSIGN(ReturnStatement); |
2448 }; | 2244 }; |
2449 | 2245 |
2450 | 2246 |
2451 class TryCatch : public Statement { | 2247 class TryCatch : public Statement { |
2452 public: | 2248 public: |
2453 static TryCatch* ReadFrom(Reader* reader); | 2249 static TryCatch* ReadFrom(Reader* reader); |
2454 | 2250 |
2455 virtual ~TryCatch(); | 2251 virtual ~TryCatch(); |
2456 | 2252 |
2457 DEFINE_CASTING_OPERATIONS(TryCatch); | 2253 DEFINE_CASTING_OPERATIONS(TryCatch); |
2458 | 2254 |
2459 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2460 virtual void VisitChildren(Visitor* visitor); | |
2461 | |
2462 Statement* body() { return body_; } | 2255 Statement* body() { return body_; } |
2463 List<Catch>& catches() { return catches_; } | 2256 List<Catch>& catches() { return catches_; } |
2464 | 2257 |
2465 private: | 2258 private: |
2466 TryCatch() {} | 2259 TryCatch() {} |
2467 | 2260 |
2468 Child<Statement> body_; | 2261 Child<Statement> body_; |
2469 List<Catch> catches_; | 2262 List<Catch> catches_; |
2470 | 2263 |
2471 DISALLOW_COPY_AND_ASSIGN(TryCatch); | 2264 DISALLOW_COPY_AND_ASSIGN(TryCatch); |
2472 }; | 2265 }; |
2473 | 2266 |
2474 | 2267 |
2475 class Catch : public TreeNode { | 2268 class Catch : public TreeNode { |
2476 public: | 2269 public: |
2477 static Catch* ReadFrom(Reader* reader); | 2270 static Catch* ReadFrom(Reader* reader); |
2478 | 2271 |
2479 virtual ~Catch(); | 2272 virtual ~Catch(); |
2480 | 2273 |
2481 DEFINE_CASTING_OPERATIONS(Catch); | 2274 DEFINE_CASTING_OPERATIONS(Catch); |
2482 | 2275 |
2483 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
2484 virtual void VisitChildren(Visitor* visitor); | |
2485 | |
2486 DartType* guard() { return guard_; } | 2276 DartType* guard() { return guard_; } |
2487 VariableDeclaration* exception() { return exception_; } | 2277 VariableDeclaration* exception() { return exception_; } |
2488 VariableDeclaration* stack_trace() { return stack_trace_; } | 2278 VariableDeclaration* stack_trace() { return stack_trace_; } |
2489 Statement* body() { return body_; } | 2279 Statement* body() { return body_; } |
2490 TokenPosition position() { return position_; } | 2280 TokenPosition position() { return position_; } |
2491 TokenPosition end_position() { return end_position_; } | 2281 TokenPosition end_position() { return end_position_; } |
2492 | 2282 |
2493 private: | 2283 private: |
2494 Catch() | 2284 Catch() |
2495 : position_(TokenPosition::kNoSource), | 2285 : position_(TokenPosition::kNoSource), |
(...skipping 14 matching lines...) Expand all Loading... |
2510 | 2300 |
2511 | 2301 |
2512 class TryFinally : public Statement { | 2302 class TryFinally : public Statement { |
2513 public: | 2303 public: |
2514 static TryFinally* ReadFrom(Reader* reader); | 2304 static TryFinally* ReadFrom(Reader* reader); |
2515 | 2305 |
2516 virtual ~TryFinally(); | 2306 virtual ~TryFinally(); |
2517 | 2307 |
2518 DEFINE_CASTING_OPERATIONS(TryFinally); | 2308 DEFINE_CASTING_OPERATIONS(TryFinally); |
2519 | 2309 |
2520 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2521 virtual void VisitChildren(Visitor* visitor); | |
2522 | |
2523 Statement* body() { return body_; } | 2310 Statement* body() { return body_; } |
2524 Statement* finalizer() { return finalizer_; } | 2311 Statement* finalizer() { return finalizer_; } |
2525 | 2312 |
2526 private: | 2313 private: |
2527 TryFinally() {} | 2314 TryFinally() {} |
2528 | 2315 |
2529 Child<Statement> body_; | 2316 Child<Statement> body_; |
2530 Child<Statement> finalizer_; | 2317 Child<Statement> finalizer_; |
2531 | 2318 |
2532 DISALLOW_COPY_AND_ASSIGN(TryFinally); | 2319 DISALLOW_COPY_AND_ASSIGN(TryFinally); |
2533 }; | 2320 }; |
2534 | 2321 |
2535 | 2322 |
2536 class YieldStatement : public Statement { | 2323 class YieldStatement : public Statement { |
2537 public: | 2324 public: |
2538 enum { | 2325 enum { |
2539 kFlagYieldStar = 1 << 0, | 2326 kFlagYieldStar = 1 << 0, |
2540 kFlagNative = 1 << 1, | 2327 kFlagNative = 1 << 1, |
2541 }; | 2328 }; |
2542 static YieldStatement* ReadFrom(Reader* reader); | 2329 static YieldStatement* ReadFrom(Reader* reader); |
2543 | 2330 |
2544 virtual ~YieldStatement(); | 2331 virtual ~YieldStatement(); |
2545 | 2332 |
2546 DEFINE_CASTING_OPERATIONS(YieldStatement); | 2333 DEFINE_CASTING_OPERATIONS(YieldStatement); |
2547 | 2334 |
2548 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2549 virtual void VisitChildren(Visitor* visitor); | |
2550 | |
2551 bool is_yield_start() { return (flags_ & kFlagYieldStar) == kFlagYieldStar; } | 2335 bool is_yield_start() { return (flags_ & kFlagYieldStar) == kFlagYieldStar; } |
2552 bool is_native() { return (flags_ & kFlagNative) == kFlagNative; } | 2336 bool is_native() { return (flags_ & kFlagNative) == kFlagNative; } |
2553 Expression* expression() { return expression_; } | 2337 Expression* expression() { return expression_; } |
2554 | 2338 |
2555 private: | 2339 private: |
2556 YieldStatement() {} | 2340 YieldStatement() {} |
2557 | 2341 |
2558 word flags_; | 2342 word flags_; |
2559 Child<Expression> expression_; | 2343 Child<Expression> expression_; |
2560 | 2344 |
2561 DISALLOW_COPY_AND_ASSIGN(YieldStatement); | 2345 DISALLOW_COPY_AND_ASSIGN(YieldStatement); |
2562 }; | 2346 }; |
2563 | 2347 |
2564 | 2348 |
2565 class VariableDeclaration : public Statement { | 2349 class VariableDeclaration : public Statement { |
2566 public: | 2350 public: |
2567 enum Flags { | 2351 enum Flags { |
2568 kFlagFinal = 1 << 0, | 2352 kFlagFinal = 1 << 0, |
2569 kFlagConst = 1 << 1, | 2353 kFlagConst = 1 << 1, |
2570 }; | 2354 }; |
2571 | 2355 |
2572 static VariableDeclaration* ReadFrom(Reader* reader); | 2356 static VariableDeclaration* ReadFrom(Reader* reader); |
2573 static VariableDeclaration* ReadFromImpl(Reader* reader, bool read_tag); | 2357 static VariableDeclaration* ReadFromImpl(Reader* reader, bool read_tag); |
2574 | 2358 |
2575 virtual ~VariableDeclaration(); | 2359 virtual ~VariableDeclaration(); |
2576 | 2360 |
2577 DEFINE_CASTING_OPERATIONS(VariableDeclaration); | 2361 DEFINE_CASTING_OPERATIONS(VariableDeclaration); |
2578 | 2362 |
2579 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2580 virtual void VisitChildren(Visitor* visitor); | |
2581 | |
2582 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } | 2363 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } |
2583 bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; } | 2364 bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; } |
2584 | 2365 |
2585 StringIndex name() { return name_index_; } | 2366 StringIndex name() { return name_index_; } |
2586 DartType* type() { return type_; } | 2367 DartType* type() { return type_; } |
2587 Expression* initializer() { return initializer_; } | 2368 Expression* initializer() { return initializer_; } |
2588 TokenPosition equals_position() { return equals_position_; } | 2369 TokenPosition equals_position() { return equals_position_; } |
2589 TokenPosition end_position() { return end_position_; } | 2370 TokenPosition end_position() { return end_position_; } |
2590 void set_end_position(TokenPosition position) { end_position_ = position; } | 2371 void set_end_position(TokenPosition position) { end_position_ = position; } |
2591 intptr_t kernel_offset_no_tag() const { return kernel_offset_no_tag_; } | 2372 intptr_t kernel_offset_no_tag() const { return kernel_offset_no_tag_; } |
(...skipping 23 matching lines...) Expand all Loading... |
2615 | 2396 |
2616 | 2397 |
2617 class FunctionDeclaration : public Statement { | 2398 class FunctionDeclaration : public Statement { |
2618 public: | 2399 public: |
2619 static FunctionDeclaration* ReadFrom(Reader* reader); | 2400 static FunctionDeclaration* ReadFrom(Reader* reader); |
2620 | 2401 |
2621 virtual ~FunctionDeclaration(); | 2402 virtual ~FunctionDeclaration(); |
2622 | 2403 |
2623 DEFINE_CASTING_OPERATIONS(FunctionDeclaration); | 2404 DEFINE_CASTING_OPERATIONS(FunctionDeclaration); |
2624 | 2405 |
2625 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | |
2626 virtual void VisitChildren(Visitor* visitor); | |
2627 | |
2628 VariableDeclaration* variable() { return variable_; } | 2406 VariableDeclaration* variable() { return variable_; } |
2629 FunctionNode* function() { return function_; } | 2407 FunctionNode* function() { return function_; } |
2630 | 2408 |
2631 private: | 2409 private: |
2632 FunctionDeclaration() {} | 2410 FunctionDeclaration() {} |
2633 | 2411 |
2634 Child<VariableDeclaration> variable_; | 2412 Child<VariableDeclaration> variable_; |
2635 Child<FunctionNode> function_; | 2413 Child<FunctionNode> function_; |
2636 | 2414 |
2637 DISALLOW_COPY_AND_ASSIGN(FunctionDeclaration); | 2415 DISALLOW_COPY_AND_ASSIGN(FunctionDeclaration); |
2638 }; | 2416 }; |
2639 | 2417 |
2640 | 2418 |
2641 class Name : public Node { | 2419 class Name : public Node { |
2642 public: | 2420 public: |
2643 static Name* ReadFrom(Reader* reader); | 2421 static Name* ReadFrom(Reader* reader); |
2644 | 2422 |
2645 virtual ~Name(); | 2423 virtual ~Name(); |
2646 | 2424 |
2647 DEFINE_CASTING_OPERATIONS(Name); | 2425 DEFINE_CASTING_OPERATIONS(Name); |
2648 | 2426 |
2649 virtual void AcceptVisitor(Visitor* visitor); | |
2650 virtual void VisitChildren(Visitor* visitor); | |
2651 | |
2652 StringIndex string_index() { return string_index_; } | 2427 StringIndex string_index() { return string_index_; } |
2653 NameIndex library() { return library_reference_; } | 2428 NameIndex library() { return library_reference_; } |
2654 | 2429 |
2655 private: | 2430 private: |
2656 Name(intptr_t string_index, intptr_t library_reference) | 2431 Name(intptr_t string_index, intptr_t library_reference) |
2657 : string_index_(string_index), | 2432 : string_index_(string_index), |
2658 library_reference_(library_reference) {} // NOLINT | 2433 library_reference_(library_reference) {} // NOLINT |
2659 | 2434 |
2660 StringIndex string_index_; | 2435 StringIndex string_index_; |
2661 NameIndex library_reference_; // Library canonical name. | 2436 NameIndex library_reference_; // Library canonical name. |
2662 | 2437 |
2663 DISALLOW_COPY_AND_ASSIGN(Name); | 2438 DISALLOW_COPY_AND_ASSIGN(Name); |
2664 }; | 2439 }; |
2665 | 2440 |
2666 | 2441 |
2667 class DartType : public Node { | 2442 class DartType : public Node { |
2668 public: | 2443 public: |
2669 static DartType* ReadFrom(Reader* reader); | 2444 static DartType* ReadFrom(Reader* reader); |
2670 | 2445 |
2671 virtual ~DartType(); | 2446 virtual ~DartType(); |
2672 | 2447 |
2673 DEFINE_CASTING_OPERATIONS(DartType); | 2448 DEFINE_CASTING_OPERATIONS(DartType); |
2674 | 2449 |
2675 virtual void AcceptVisitor(Visitor* visitor); | |
2676 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor) = 0; | 2450 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor) = 0; |
2677 | 2451 |
2678 protected: | 2452 protected: |
2679 DartType() {} | 2453 DartType() {} |
2680 | 2454 |
2681 private: | 2455 private: |
2682 DISALLOW_COPY_AND_ASSIGN(DartType); | 2456 DISALLOW_COPY_AND_ASSIGN(DartType); |
2683 }; | 2457 }; |
2684 | 2458 |
2685 | 2459 |
2686 class InvalidType : public DartType { | 2460 class InvalidType : public DartType { |
2687 public: | 2461 public: |
2688 static InvalidType* ReadFrom(Reader* reader); | 2462 static InvalidType* ReadFrom(Reader* reader); |
2689 | 2463 |
2690 virtual ~InvalidType(); | 2464 virtual ~InvalidType(); |
2691 | 2465 |
2692 DEFINE_CASTING_OPERATIONS(InvalidType); | 2466 DEFINE_CASTING_OPERATIONS(InvalidType); |
2693 | 2467 |
2694 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2468 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2695 virtual void VisitChildren(Visitor* visitor); | |
2696 | 2469 |
2697 private: | 2470 private: |
2698 InvalidType() {} | 2471 InvalidType() {} |
2699 | 2472 |
2700 DISALLOW_COPY_AND_ASSIGN(InvalidType); | 2473 DISALLOW_COPY_AND_ASSIGN(InvalidType); |
2701 }; | 2474 }; |
2702 | 2475 |
2703 | 2476 |
2704 class DynamicType : public DartType { | 2477 class DynamicType : public DartType { |
2705 public: | 2478 public: |
2706 static DynamicType* ReadFrom(Reader* reader); | 2479 static DynamicType* ReadFrom(Reader* reader); |
2707 | 2480 |
2708 virtual ~DynamicType(); | 2481 virtual ~DynamicType(); |
2709 | 2482 |
2710 DEFINE_CASTING_OPERATIONS(DynamicType); | 2483 DEFINE_CASTING_OPERATIONS(DynamicType); |
2711 | 2484 |
2712 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2485 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2713 virtual void VisitChildren(Visitor* visitor); | |
2714 | 2486 |
2715 private: | 2487 private: |
2716 DynamicType() {} | 2488 DynamicType() {} |
2717 | 2489 |
2718 DISALLOW_COPY_AND_ASSIGN(DynamicType); | 2490 DISALLOW_COPY_AND_ASSIGN(DynamicType); |
2719 }; | 2491 }; |
2720 | 2492 |
2721 | 2493 |
2722 class VoidType : public DartType { | 2494 class VoidType : public DartType { |
2723 public: | 2495 public: |
2724 static VoidType* ReadFrom(Reader* reader); | 2496 static VoidType* ReadFrom(Reader* reader); |
2725 | 2497 |
2726 virtual ~VoidType(); | 2498 virtual ~VoidType(); |
2727 | 2499 |
2728 DEFINE_CASTING_OPERATIONS(VoidType); | 2500 DEFINE_CASTING_OPERATIONS(VoidType); |
2729 | 2501 |
2730 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2502 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2731 virtual void VisitChildren(Visitor* visitor); | |
2732 | 2503 |
2733 private: | 2504 private: |
2734 VoidType() {} | 2505 VoidType() {} |
2735 | 2506 |
2736 DISALLOW_COPY_AND_ASSIGN(VoidType); | 2507 DISALLOW_COPY_AND_ASSIGN(VoidType); |
2737 }; | 2508 }; |
2738 | 2509 |
2739 | 2510 |
2740 class BottomType : public DartType { | 2511 class BottomType : public DartType { |
2741 public: | 2512 public: |
2742 static BottomType* ReadFrom(Reader* reader); | 2513 static BottomType* ReadFrom(Reader* reader); |
2743 | 2514 |
2744 virtual ~BottomType(); | 2515 virtual ~BottomType(); |
2745 | 2516 |
2746 DEFINE_CASTING_OPERATIONS(BottomType); | 2517 DEFINE_CASTING_OPERATIONS(BottomType); |
2747 | 2518 |
2748 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2519 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2749 virtual void VisitChildren(Visitor* visitor); | |
2750 | 2520 |
2751 private: | 2521 private: |
2752 BottomType() {} | 2522 BottomType() {} |
2753 | 2523 |
2754 DISALLOW_COPY_AND_ASSIGN(BottomType); | 2524 DISALLOW_COPY_AND_ASSIGN(BottomType); |
2755 }; | 2525 }; |
2756 | 2526 |
2757 | 2527 |
2758 class InterfaceType : public DartType { | 2528 class InterfaceType : public DartType { |
2759 public: | 2529 public: |
2760 static InterfaceType* ReadFrom(Reader* reader); | 2530 static InterfaceType* ReadFrom(Reader* reader); |
2761 static InterfaceType* ReadFrom(Reader* reader, bool _without_type_arguments_); | 2531 static InterfaceType* ReadFrom(Reader* reader, bool _without_type_arguments_); |
2762 | 2532 |
2763 explicit InterfaceType(NameIndex class_reference) | 2533 explicit InterfaceType(NameIndex class_reference) |
2764 : class_reference_(class_reference) {} | 2534 : class_reference_(class_reference) {} |
2765 virtual ~InterfaceType(); | 2535 virtual ~InterfaceType(); |
2766 | 2536 |
2767 DEFINE_CASTING_OPERATIONS(InterfaceType); | 2537 DEFINE_CASTING_OPERATIONS(InterfaceType); |
2768 | 2538 |
2769 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2539 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2770 virtual void VisitChildren(Visitor* visitor); | |
2771 | 2540 |
2772 NameIndex klass() { return class_reference_; } | 2541 NameIndex klass() { return class_reference_; } |
2773 List<DartType>& type_arguments() { return type_arguments_; } | 2542 List<DartType>& type_arguments() { return type_arguments_; } |
2774 | 2543 |
2775 private: | 2544 private: |
2776 InterfaceType() {} | 2545 InterfaceType() {} |
2777 | 2546 |
2778 NameIndex class_reference_; // Class canonical name. | 2547 NameIndex class_reference_; // Class canonical name. |
2779 List<DartType> type_arguments_; | 2548 List<DartType> type_arguments_; |
2780 | 2549 |
2781 DISALLOW_COPY_AND_ASSIGN(InterfaceType); | 2550 DISALLOW_COPY_AND_ASSIGN(InterfaceType); |
2782 }; | 2551 }; |
2783 | 2552 |
2784 | 2553 |
2785 class TypedefType : public DartType { | 2554 class TypedefType : public DartType { |
2786 public: | 2555 public: |
2787 static TypedefType* ReadFrom(Reader* reader); | 2556 static TypedefType* ReadFrom(Reader* reader); |
2788 | 2557 |
2789 explicit TypedefType(NameIndex class_reference) | 2558 explicit TypedefType(NameIndex class_reference) |
2790 : typedef_reference_(class_reference) {} | 2559 : typedef_reference_(class_reference) {} |
2791 virtual ~TypedefType(); | 2560 virtual ~TypedefType(); |
2792 | 2561 |
2793 DEFINE_CASTING_OPERATIONS(TypedefType); | 2562 DEFINE_CASTING_OPERATIONS(TypedefType); |
2794 | 2563 |
2795 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2564 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2796 virtual void VisitChildren(Visitor* visitor); | |
2797 | 2565 |
2798 NameIndex typedef_reference() { return typedef_reference_; } | 2566 NameIndex typedef_reference() { return typedef_reference_; } |
2799 List<DartType>& type_arguments() { return type_arguments_; } | 2567 List<DartType>& type_arguments() { return type_arguments_; } |
2800 | 2568 |
2801 private: | 2569 private: |
2802 TypedefType() {} | 2570 TypedefType() {} |
2803 | 2571 |
2804 NameIndex typedef_reference_; // Typedef canonical name. | 2572 NameIndex typedef_reference_; // Typedef canonical name. |
2805 List<DartType> type_arguments_; | 2573 List<DartType> type_arguments_; |
2806 | 2574 |
(...skipping 24 matching lines...) Expand all Loading... |
2831 class FunctionType : public DartType { | 2599 class FunctionType : public DartType { |
2832 public: | 2600 public: |
2833 static FunctionType* ReadFrom(Reader* reader); | 2601 static FunctionType* ReadFrom(Reader* reader); |
2834 static FunctionType* ReadFrom(Reader* reader, bool _without_type_arguments_); | 2602 static FunctionType* ReadFrom(Reader* reader, bool _without_type_arguments_); |
2835 | 2603 |
2836 virtual ~FunctionType(); | 2604 virtual ~FunctionType(); |
2837 | 2605 |
2838 DEFINE_CASTING_OPERATIONS(FunctionType); | 2606 DEFINE_CASTING_OPERATIONS(FunctionType); |
2839 | 2607 |
2840 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2608 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2841 virtual void VisitChildren(Visitor* visitor); | |
2842 | 2609 |
2843 TypeParameterList& type_parameters() { return type_parameters_; } | 2610 TypeParameterList& type_parameters() { return type_parameters_; } |
2844 int required_parameter_count() { return required_parameter_count_; } | 2611 int required_parameter_count() { return required_parameter_count_; } |
2845 List<DartType>& positional_parameters() { return positional_parameters_; } | 2612 List<DartType>& positional_parameters() { return positional_parameters_; } |
2846 List<NamedParameter>& named_parameters() { return named_parameters_; } | 2613 List<NamedParameter>& named_parameters() { return named_parameters_; } |
2847 DartType* return_type() { return return_type_; } | 2614 DartType* return_type() { return return_type_; } |
2848 | 2615 |
2849 private: | 2616 private: |
2850 FunctionType() {} | 2617 FunctionType() {} |
2851 | 2618 |
2852 TypeParameterList type_parameters_; | 2619 TypeParameterList type_parameters_; |
2853 int required_parameter_count_; | 2620 int required_parameter_count_; |
2854 List<DartType> positional_parameters_; | 2621 List<DartType> positional_parameters_; |
2855 List<NamedParameter> named_parameters_; | 2622 List<NamedParameter> named_parameters_; |
2856 Child<DartType> return_type_; | 2623 Child<DartType> return_type_; |
2857 | 2624 |
2858 DISALLOW_COPY_AND_ASSIGN(FunctionType); | 2625 DISALLOW_COPY_AND_ASSIGN(FunctionType); |
2859 }; | 2626 }; |
2860 | 2627 |
2861 | 2628 |
2862 class TypeParameterType : public DartType { | 2629 class TypeParameterType : public DartType { |
2863 public: | 2630 public: |
2864 static TypeParameterType* ReadFrom(Reader* reader); | 2631 static TypeParameterType* ReadFrom(Reader* reader); |
2865 | 2632 |
2866 virtual ~TypeParameterType(); | 2633 virtual ~TypeParameterType(); |
2867 | 2634 |
2868 DEFINE_CASTING_OPERATIONS(TypeParameterType); | 2635 DEFINE_CASTING_OPERATIONS(TypeParameterType); |
2869 | 2636 |
2870 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2637 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2871 virtual void VisitChildren(Visitor* visitor); | |
2872 | 2638 |
2873 TypeParameter* parameter() { return parameter_; } | 2639 TypeParameter* parameter() { return parameter_; } |
2874 | 2640 |
2875 private: | 2641 private: |
2876 TypeParameterType() {} | 2642 TypeParameterType() {} |
2877 | 2643 |
2878 Ref<TypeParameter> parameter_; | 2644 Ref<TypeParameter> parameter_; |
2879 | 2645 |
2880 DISALLOW_COPY_AND_ASSIGN(TypeParameterType); | 2646 DISALLOW_COPY_AND_ASSIGN(TypeParameterType); |
2881 }; | 2647 }; |
2882 | 2648 |
2883 | 2649 |
2884 class VectorType : public DartType { | 2650 class VectorType : public DartType { |
2885 public: | 2651 public: |
2886 static VectorType* ReadFrom(Reader* reader); | 2652 static VectorType* ReadFrom(Reader* reader); |
2887 | 2653 |
2888 virtual ~VectorType(); | 2654 virtual ~VectorType(); |
2889 | 2655 |
2890 DEFINE_CASTING_OPERATIONS(VectorType); | 2656 DEFINE_CASTING_OPERATIONS(VectorType); |
2891 | 2657 |
2892 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); | 2658 virtual void AcceptDartTypeVisitor(DartTypeVisitor* visitor); |
2893 virtual void VisitChildren(Visitor* visitor); | |
2894 | 2659 |
2895 private: | 2660 private: |
2896 VectorType() {} | 2661 VectorType() {} |
2897 | 2662 |
2898 DISALLOW_COPY_AND_ASSIGN(VectorType); | 2663 DISALLOW_COPY_AND_ASSIGN(VectorType); |
2899 }; | 2664 }; |
2900 | 2665 |
2901 | 2666 |
2902 class TypeParameter : public TreeNode { | 2667 class TypeParameter : public TreeNode { |
2903 public: | 2668 public: |
2904 TypeParameter* ReadFrom(Reader* reader); | 2669 TypeParameter* ReadFrom(Reader* reader); |
2905 | 2670 |
2906 virtual ~TypeParameter(); | 2671 virtual ~TypeParameter(); |
2907 | 2672 |
2908 DEFINE_CASTING_OPERATIONS(TypeParameter); | 2673 DEFINE_CASTING_OPERATIONS(TypeParameter); |
2909 | 2674 |
2910 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
2911 virtual void VisitChildren(Visitor* visitor); | |
2912 | |
2913 StringIndex name() { return name_index_; } | 2675 StringIndex name() { return name_index_; } |
2914 DartType* bound() { return bound_; } | 2676 DartType* bound() { return bound_; } |
2915 | 2677 |
2916 private: | 2678 private: |
2917 TypeParameter() {} | 2679 TypeParameter() {} |
2918 | 2680 |
2919 template <typename T> | 2681 template <typename T> |
2920 friend class List; | 2682 friend class List; |
2921 friend class TypeParameterList; | 2683 friend class TypeParameterList; |
2922 | 2684 |
2923 StringIndex name_index_; | 2685 StringIndex name_index_; |
2924 Child<DartType> bound_; | 2686 Child<DartType> bound_; |
2925 | 2687 |
2926 DISALLOW_COPY_AND_ASSIGN(TypeParameter); | 2688 DISALLOW_COPY_AND_ASSIGN(TypeParameter); |
2927 }; | 2689 }; |
2928 | 2690 |
2929 | 2691 |
2930 class Program : public TreeNode { | 2692 class Program : public TreeNode { |
2931 public: | 2693 public: |
2932 static Program* ReadFrom(Reader* reader); | 2694 static Program* ReadFrom(Reader* reader); |
2933 | 2695 |
2934 virtual ~Program(); | 2696 virtual ~Program(); |
2935 | 2697 |
2936 DEFINE_CASTING_OPERATIONS(Program); | 2698 DEFINE_CASTING_OPERATIONS(Program); |
2937 | 2699 |
2938 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | |
2939 virtual void VisitChildren(Visitor* visitor); | |
2940 | |
2941 SourceTable& source_table() { return source_table_; } | 2700 SourceTable& source_table() { return source_table_; } |
2942 List<Library>& libraries() { return libraries_; } | 2701 List<Library>& libraries() { return libraries_; } |
2943 NameIndex main_method() { return main_method_reference_; } | 2702 NameIndex main_method() { return main_method_reference_; } |
2944 MallocGrowableArray<MallocGrowableArray<intptr_t>*> valid_token_positions; | 2703 MallocGrowableArray<MallocGrowableArray<intptr_t>*> valid_token_positions; |
2945 MallocGrowableArray<MallocGrowableArray<intptr_t>*> yield_token_positions; | 2704 MallocGrowableArray<MallocGrowableArray<intptr_t>*> yield_token_positions; |
2946 intptr_t string_table_offset() { return string_table_offset_; } | 2705 intptr_t string_table_offset() { return string_table_offset_; } |
2947 intptr_t name_table_offset() { return name_table_offset_; } | 2706 intptr_t name_table_offset() { return name_table_offset_; } |
2948 | 2707 |
2949 private: | 2708 private: |
2950 Program() {} | 2709 Program() {} |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3080 virtual void VisitVectorSet(VectorSet* node) { VisitDefaultExpression(node); } | 2839 virtual void VisitVectorSet(VectorSet* node) { VisitDefaultExpression(node); } |
3081 virtual void VisitVectorCopy(VectorCopy* node) { | 2840 virtual void VisitVectorCopy(VectorCopy* node) { |
3082 VisitDefaultExpression(node); | 2841 VisitDefaultExpression(node); |
3083 } | 2842 } |
3084 virtual void VisitClosureCreation(ClosureCreation* node) { | 2843 virtual void VisitClosureCreation(ClosureCreation* node) { |
3085 VisitDefaultExpression(node); | 2844 VisitDefaultExpression(node); |
3086 } | 2845 } |
3087 }; | 2846 }; |
3088 | 2847 |
3089 | 2848 |
3090 class StatementVisitor { | |
3091 public: | |
3092 virtual ~StatementVisitor() {} | |
3093 | |
3094 virtual void VisitDefaultStatement(Statement* node) = 0; | |
3095 virtual void VisitInvalidStatement(InvalidStatement* node) { | |
3096 VisitDefaultStatement(node); | |
3097 } | |
3098 virtual void VisitExpressionStatement(ExpressionStatement* node) { | |
3099 VisitDefaultStatement(node); | |
3100 } | |
3101 virtual void VisitBlock(Block* node) { VisitDefaultStatement(node); } | |
3102 virtual void VisitEmptyStatement(EmptyStatement* node) { | |
3103 VisitDefaultStatement(node); | |
3104 } | |
3105 virtual void VisitAssertStatement(AssertStatement* node) { | |
3106 VisitDefaultStatement(node); | |
3107 } | |
3108 virtual void VisitLabeledStatement(LabeledStatement* node) { | |
3109 VisitDefaultStatement(node); | |
3110 } | |
3111 virtual void VisitBreakStatement(BreakStatement* node) { | |
3112 VisitDefaultStatement(node); | |
3113 } | |
3114 virtual void VisitWhileStatement(WhileStatement* node) { | |
3115 VisitDefaultStatement(node); | |
3116 } | |
3117 virtual void VisitDoStatement(DoStatement* node) { | |
3118 VisitDefaultStatement(node); | |
3119 } | |
3120 virtual void VisitForStatement(ForStatement* node) { | |
3121 VisitDefaultStatement(node); | |
3122 } | |
3123 virtual void VisitForInStatement(ForInStatement* node) { | |
3124 VisitDefaultStatement(node); | |
3125 } | |
3126 virtual void VisitSwitchStatement(SwitchStatement* node) { | |
3127 VisitDefaultStatement(node); | |
3128 } | |
3129 virtual void VisitContinueSwitchStatement(ContinueSwitchStatement* node) { | |
3130 VisitDefaultStatement(node); | |
3131 } | |
3132 virtual void VisitIfStatement(IfStatement* node) { | |
3133 VisitDefaultStatement(node); | |
3134 } | |
3135 virtual void VisitReturnStatement(ReturnStatement* node) { | |
3136 VisitDefaultStatement(node); | |
3137 } | |
3138 virtual void VisitTryCatch(TryCatch* node) { VisitDefaultStatement(node); } | |
3139 virtual void VisitTryFinally(TryFinally* node) { | |
3140 VisitDefaultStatement(node); | |
3141 } | |
3142 virtual void VisitYieldStatement(YieldStatement* node) { | |
3143 VisitDefaultStatement(node); | |
3144 } | |
3145 virtual void VisitVariableDeclaration(VariableDeclaration* node) { | |
3146 VisitDefaultStatement(node); | |
3147 } | |
3148 virtual void VisitFunctionDeclaration(FunctionDeclaration* node) { | |
3149 VisitDefaultStatement(node); | |
3150 } | |
3151 }; | |
3152 | |
3153 | |
3154 class MemberVisitor { | |
3155 public: | |
3156 virtual ~MemberVisitor() {} | |
3157 | |
3158 virtual void VisitDefaultMember(Member* node) = 0; | |
3159 virtual void VisitConstructor(Constructor* node) { VisitDefaultMember(node); } | |
3160 virtual void VisitProcedure(Procedure* node) { VisitDefaultMember(node); } | |
3161 virtual void VisitField(Field* node) { VisitDefaultMember(node); } | |
3162 }; | |
3163 | |
3164 | |
3165 class ClassVisitor { | |
3166 public: | |
3167 virtual ~ClassVisitor() {} | |
3168 | |
3169 virtual void VisitDefaultClass(Class* node) = 0; | |
3170 virtual void VisitNormalClass(NormalClass* node) { VisitDefaultClass(node); } | |
3171 virtual void VisitMixinClass(MixinClass* node) { VisitDefaultClass(node); } | |
3172 }; | |
3173 | |
3174 | |
3175 class InitializerVisitor { | |
3176 public: | |
3177 virtual ~InitializerVisitor() {} | |
3178 | |
3179 virtual void VisitDefaultInitializer(Initializer* node) = 0; | |
3180 virtual void VisitInvalidInitializer(InvalidInitializer* node) { | |
3181 VisitDefaultInitializer(node); | |
3182 } | |
3183 virtual void VisitFieldInitializer(FieldInitializer* node) { | |
3184 VisitDefaultInitializer(node); | |
3185 } | |
3186 virtual void VisitSuperInitializer(SuperInitializer* node) { | |
3187 VisitDefaultInitializer(node); | |
3188 } | |
3189 virtual void VisitRedirectingInitializer(RedirectingInitializer* node) { | |
3190 VisitDefaultInitializer(node); | |
3191 } | |
3192 virtual void VisitLocalInitializer(LocalInitializer* node) { | |
3193 VisitDefaultInitializer(node); | |
3194 } | |
3195 }; | |
3196 | |
3197 | |
3198 class DartTypeVisitor { | 2849 class DartTypeVisitor { |
3199 public: | 2850 public: |
3200 virtual ~DartTypeVisitor() {} | 2851 virtual ~DartTypeVisitor() {} |
3201 | 2852 |
3202 virtual void VisitDefaultDartType(DartType* node) = 0; | 2853 virtual void VisitDefaultDartType(DartType* node) = 0; |
3203 virtual void VisitInvalidType(InvalidType* node) { | 2854 virtual void VisitInvalidType(InvalidType* node) { |
3204 VisitDefaultDartType(node); | 2855 VisitDefaultDartType(node); |
3205 } | 2856 } |
3206 virtual void VisitDynamicType(DynamicType* node) { | 2857 virtual void VisitDynamicType(DynamicType* node) { |
3207 VisitDefaultDartType(node); | 2858 VisitDefaultDartType(node); |
3208 } | 2859 } |
3209 virtual void VisitVoidType(VoidType* node) { VisitDefaultDartType(node); } | 2860 virtual void VisitVoidType(VoidType* node) { VisitDefaultDartType(node); } |
3210 virtual void VisitBottomType(BottomType* node) { VisitDefaultDartType(node); } | 2861 virtual void VisitBottomType(BottomType* node) { VisitDefaultDartType(node); } |
3211 virtual void VisitInterfaceType(InterfaceType* node) { | 2862 virtual void VisitInterfaceType(InterfaceType* node) { |
3212 VisitDefaultDartType(node); | 2863 VisitDefaultDartType(node); |
3213 } | 2864 } |
3214 virtual void VisitFunctionType(FunctionType* node) { | 2865 virtual void VisitFunctionType(FunctionType* node) { |
3215 VisitDefaultDartType(node); | 2866 VisitDefaultDartType(node); |
3216 } | 2867 } |
3217 virtual void VisitTypeParameterType(TypeParameterType* node) { | 2868 virtual void VisitTypeParameterType(TypeParameterType* node) { |
3218 VisitDefaultDartType(node); | 2869 VisitDefaultDartType(node); |
3219 } | 2870 } |
3220 virtual void VisitVectorType(VectorType* node) { VisitDefaultDartType(node); } | 2871 virtual void VisitVectorType(VectorType* node) { VisitDefaultDartType(node); } |
3221 virtual void VisitTypedefType(TypedefType* node) { | 2872 virtual void VisitTypedefType(TypedefType* node) { |
3222 VisitDefaultDartType(node); | 2873 VisitDefaultDartType(node); |
3223 } | 2874 } |
3224 }; | 2875 }; |
3225 | 2876 |
3226 | 2877 |
3227 class TreeVisitor : public ExpressionVisitor, | |
3228 public StatementVisitor, | |
3229 public MemberVisitor, | |
3230 public ClassVisitor, | |
3231 public InitializerVisitor { | |
3232 public: | |
3233 virtual ~TreeVisitor() {} | |
3234 | |
3235 virtual void VisitDefaultTreeNode(TreeNode* node) = 0; | |
3236 virtual void VisitDefaultStatement(Statement* node) { | |
3237 VisitDefaultTreeNode(node); | |
3238 } | |
3239 virtual void VisitDefaultExpression(Expression* node) { | |
3240 VisitDefaultTreeNode(node); | |
3241 } | |
3242 virtual void VisitDefaultMember(Member* node) { VisitDefaultTreeNode(node); } | |
3243 virtual void VisitDefaultClass(Class* node) { VisitDefaultTreeNode(node); } | |
3244 virtual void VisitDefaultInitializer(Initializer* node) { | |
3245 VisitDefaultTreeNode(node); | |
3246 } | |
3247 | |
3248 virtual void VisitLibrary(Library* node) { VisitDefaultTreeNode(node); } | |
3249 virtual void VisitTypeParameter(TypeParameter* node) { | |
3250 VisitDefaultTreeNode(node); | |
3251 } | |
3252 virtual void VisitFunctionNode(FunctionNode* node) { | |
3253 VisitDefaultTreeNode(node); | |
3254 } | |
3255 virtual void VisitArguments(Arguments* node) { VisitDefaultTreeNode(node); } | |
3256 virtual void VisitNamedExpression(NamedExpression* node) { | |
3257 VisitDefaultTreeNode(node); | |
3258 } | |
3259 virtual void VisitSwitchCase(SwitchCase* node) { VisitDefaultTreeNode(node); } | |
3260 virtual void VisitCatch(Catch* node) { VisitDefaultTreeNode(node); } | |
3261 virtual void VisitMapEntry(MapEntry* node) { VisitDefaultTreeNode(node); } | |
3262 virtual void VisitProgram(Program* node) { VisitDefaultTreeNode(node); } | |
3263 virtual void VisitTypedef(Typedef* node) { VisitDefaultTreeNode(node); } | |
3264 }; | |
3265 | |
3266 | |
3267 class Visitor : public TreeVisitor, public DartTypeVisitor { | |
3268 public: | |
3269 virtual ~Visitor() {} | |
3270 | |
3271 virtual void VisitDefaultNode(Node* node) = 0; | |
3272 virtual void VisitDefaultTreeNode(TreeNode* node) { VisitDefaultNode(node); } | |
3273 virtual void VisitDefaultDartType(DartType* node) { VisitDefaultNode(node); } | |
3274 virtual void VisitName(Name* node) { VisitDefaultNode(node); } | |
3275 virtual void VisitDefaultClassReference(Class* node) { | |
3276 VisitDefaultNode(node); | |
3277 } | |
3278 virtual void VisitDefaultMemberReference(Member* node) { | |
3279 VisitDefaultNode(node); | |
3280 } | |
3281 }; | |
3282 | |
3283 | |
3284 class RecursiveVisitor : public Visitor { | |
3285 public: | |
3286 virtual ~RecursiveVisitor() {} | |
3287 | |
3288 virtual void VisitDefaultNode(Node* node) { node->VisitChildren(this); } | |
3289 | |
3290 virtual void VisitDefaultClassReference(Class* node) {} | |
3291 virtual void VisitDefaultMemberReference(Member* node) {} | |
3292 }; | |
3293 | |
3294 | |
3295 template <typename T> | 2878 template <typename T> |
3296 List<T>::~List() { | 2879 List<T>::~List() { |
3297 for (int i = 0; i < length_; i++) { | 2880 for (int i = 0; i < length_; i++) { |
3298 delete array_[i]; | 2881 delete array_[i]; |
3299 } | 2882 } |
3300 delete[] array_; | 2883 delete[] array_; |
3301 } | 2884 } |
3302 | 2885 |
3303 | 2886 |
3304 template <typename T> | 2887 template <typename T> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 } // namespace kernel | 2947 } // namespace kernel |
3365 | 2948 |
3366 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, | 2949 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, |
3367 intptr_t buffer_length); | 2950 intptr_t buffer_length); |
3368 | 2951 |
3369 | 2952 |
3370 } // namespace dart | 2953 } // namespace dart |
3371 | 2954 |
3372 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 2955 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
3373 #endif // RUNTIME_VM_KERNEL_H_ | 2956 #endif // RUNTIME_VM_KERNEL_H_ |
OLD | NEW |