OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 VM_AST_H_ | 5 #ifndef VM_AST_H_ |
6 #define VM_AST_H_ | 6 #define VM_AST_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 SourceLabel* label, | 826 SourceLabel* label, |
827 SequenceNode* body) | 827 SequenceNode* body) |
828 : AstNode(token_pos), | 828 : AstNode(token_pos), |
829 label_(label), | 829 label_(label), |
830 body_(body) { | 830 body_(body) { |
831 ASSERT(label_ != NULL); | 831 ASSERT(label_ != NULL); |
832 ASSERT(body_ != NULL); | 832 ASSERT(body_ != NULL); |
833 } | 833 } |
834 | 834 |
835 SourceLabel* label() const { return label_; } | 835 SourceLabel* label() const { return label_; } |
836 AstNode* body() const { return body_; } | 836 SequenceNode* body() const { return body_; } |
837 | 837 |
838 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 838 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
839 body()->Visit(visitor); | 839 body()->Visit(visitor); |
840 } | 840 } |
841 | 841 |
842 DECLARE_COMMON_NODE_FUNCTIONS(SwitchNode); | 842 DECLARE_COMMON_NODE_FUNCTIONS(SwitchNode); |
843 | 843 |
844 private: | 844 private: |
845 SourceLabel* label_; | 845 SourceLabel* label_; |
846 AstNode* body_; | 846 SequenceNode* body_; |
847 | 847 |
848 DISALLOW_IMPLICIT_CONSTRUCTORS(SwitchNode); | 848 DISALLOW_IMPLICIT_CONSTRUCTORS(SwitchNode); |
849 }; | 849 }; |
850 | 850 |
851 | 851 |
852 class WhileNode : public AstNode { | 852 class WhileNode : public AstNode { |
853 public: | 853 public: |
854 WhileNode(intptr_t token_pos, | 854 WhileNode(intptr_t token_pos, |
855 SourceLabel* label, | 855 SourceLabel* label, |
856 AstNode* condition, | 856 AstNode* condition, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 public: | 972 public: |
973 JumpNode(intptr_t token_pos, | 973 JumpNode(intptr_t token_pos, |
974 Token::Kind kind, | 974 Token::Kind kind, |
975 SourceLabel* label) | 975 SourceLabel* label) |
976 : AstNode(token_pos), | 976 : AstNode(token_pos), |
977 kind_(kind), | 977 kind_(kind), |
978 label_(label), | 978 label_(label), |
979 inlined_finally_list_() { | 979 inlined_finally_list_() { |
980 ASSERT(label_ != NULL); | 980 ASSERT(label_ != NULL); |
981 ASSERT(kind_ == Token::kBREAK || kind_ == Token::kCONTINUE); | 981 ASSERT(kind_ == Token::kBREAK || kind_ == Token::kCONTINUE); |
982 if (kind_ == Token::kCONTINUE) { | |
983 label_->set_is_continue_target(true); | |
984 } | |
985 } | 982 } |
986 | 983 |
987 SourceLabel* label() const { return label_; } | 984 SourceLabel* label() const { return label_; } |
988 Token::Kind kind() const { return kind_; } | 985 Token::Kind kind() const { return kind_; } |
989 | 986 |
990 intptr_t inlined_finally_list_length() const { | 987 intptr_t inlined_finally_list_length() const { |
991 return inlined_finally_list_.length(); | 988 return inlined_finally_list_.length(); |
992 } | 989 } |
993 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const { | 990 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const { |
994 return inlined_finally_list_[index]; | 991 return inlined_finally_list_[index]; |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 const intptr_t try_index_; | 1770 const intptr_t try_index_; |
1774 | 1771 |
1775 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1772 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1776 }; | 1773 }; |
1777 | 1774 |
1778 } // namespace dart | 1775 } // namespace dart |
1779 | 1776 |
1780 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1777 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1781 | 1778 |
1782 #endif // VM_AST_H_ | 1779 #endif // VM_AST_H_ |
OLD | NEW |