| 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" |
| 11 #include "vm/scopes.h" | 11 #include "vm/scopes.h" |
| 12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 #include "vm/native_entry.h" | 13 #include "vm/native_entry.h" |
| 14 #include "vm/token.h" | 14 #include "vm/token.h" |
| 15 | 15 |
| 16 namespace dart { | 16 namespace dart { |
| 17 | 17 |
| 18 #define NODE_LIST(V) \ | 18 #define NODE_LIST(V) \ |
| 19 V(ReturnNode, "return") \ | 19 V(ReturnNode, "return") \ |
| 20 V(LiteralNode, "literal") \ | 20 V(LiteralNode, "literal") \ |
| 21 V(TypeNode, "type") \ | 21 V(TypeNode, "type") \ |
| 22 V(AssignableNode, "assignable") \ | 22 V(AssignableNode, "assignable") \ |
| 23 V(BinaryOpNode, "binop") \ | 23 V(BinaryOpNode, "binop") \ |
| 24 V(StringConcatNode, "concat") \ | 24 V(StringConcatNode, "concat") \ |
| 25 V(ComparisonNode, "compare") \ | 25 V(ComparisonNode, "compare") \ |
| 26 V(UnaryOpNode, "unaryop") \ | 26 V(UnaryOpNode, "unaryop") \ |
| 27 V(IncrOpLocalNode, "incr local") \ | 27 V(IncrOpLocalNode, "incr local") \ |
| 28 V(IncrOpInstanceFieldNode, "incr instance field") \ | 28 V(IncrOpInstanceFieldNode, "incr instance field") \ |
| 29 V(IncrOpStaticFieldNode, "incr static field") \ | |
| 30 V(IncrOpIndexedNode, "incr indexed") \ | 29 V(IncrOpIndexedNode, "incr indexed") \ |
| 31 V(ConditionalExprNode, "?:") \ | 30 V(ConditionalExprNode, "?:") \ |
| 32 V(IfNode, "if") \ | 31 V(IfNode, "if") \ |
| 33 V(SwitchNode, "switch") \ | 32 V(SwitchNode, "switch") \ |
| 34 V(CaseNode, "case") \ | 33 V(CaseNode, "case") \ |
| 35 V(WhileNode, "while") \ | 34 V(WhileNode, "while") \ |
| 36 V(DoWhileNode, "dowhile") \ | 35 V(DoWhileNode, "dowhile") \ |
| 37 V(ForNode, "for") \ | 36 V(ForNode, "for") \ |
| 38 V(JumpNode, "jump") \ | 37 V(JumpNode, "jump") \ |
| 39 V(ArgumentListNode, "args") \ | 38 V(ArgumentListNode, "args") \ |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 const String& field_name_; | 751 const String& field_name_; |
| 753 const intptr_t operator_id_; | 752 const intptr_t operator_id_; |
| 754 const intptr_t setter_id_; | 753 const intptr_t setter_id_; |
| 755 ICData& operator_ic_data_; | 754 ICData& operator_ic_data_; |
| 756 ICData& setter_ic_data_; | 755 ICData& setter_ic_data_; |
| 757 | 756 |
| 758 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrOpInstanceFieldNode); | 757 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrOpInstanceFieldNode); |
| 759 }; | 758 }; |
| 760 | 759 |
| 761 | 760 |
| 762 class IncrOpStaticFieldNode : public AstNode { | |
| 763 public: | |
| 764 // Access the static field via a call to static getter. | |
| 765 IncrOpStaticFieldNode(intptr_t token_index, | |
| 766 Token::Kind kind, | |
| 767 bool prefix, | |
| 768 const Class& field_class, | |
| 769 const String& field_name) | |
| 770 : AstNode(token_index), | |
| 771 kind_(kind), | |
| 772 prefix_(prefix), | |
| 773 field_class_(field_class), | |
| 774 field_name_(field_name), | |
| 775 field_(Field::ZoneHandle()) { | |
| 776 ASSERT(field_class_.IsZoneHandle()); | |
| 777 ASSERT(field_name_.IsZoneHandle()); | |
| 778 ASSERT(kind_ == Token::kINCR || kind_ == Token::kDECR); | |
| 779 } | |
| 780 | |
| 781 // Access the static field directly. | |
| 782 IncrOpStaticFieldNode(intptr_t token_index, | |
| 783 Token::Kind kind, | |
| 784 bool prefix, | |
| 785 const Field& field) | |
| 786 : AstNode(token_index), | |
| 787 kind_(kind), | |
| 788 prefix_(prefix), | |
| 789 field_class_(Class::ZoneHandle()), | |
| 790 field_name_(String::ZoneHandle()), | |
| 791 field_(field) { | |
| 792 ASSERT(field_.IsZoneHandle()); | |
| 793 ASSERT(kind_ == Token::kINCR || kind_ == Token::kDECR); | |
| 794 } | |
| 795 | |
| 796 Token::Kind kind() const { return kind_; } | |
| 797 bool prefix() const { return prefix_; } | |
| 798 const Class& field_class() const { return field_class_; } | |
| 799 const String& field_name() const { return field_name_; } | |
| 800 const Field& field() const { return field_; } | |
| 801 | |
| 802 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | |
| 803 | |
| 804 virtual const char* Name() const; | |
| 805 | |
| 806 DECLARE_COMMON_NODE_FUNCTIONS(IncrOpStaticFieldNode); | |
| 807 | |
| 808 private: | |
| 809 const Token::Kind kind_; | |
| 810 const bool prefix_; | |
| 811 const Class& field_class_; | |
| 812 const String& field_name_; | |
| 813 const Field& field_; | |
| 814 | |
| 815 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrOpStaticFieldNode); | |
| 816 }; | |
| 817 | |
| 818 | |
| 819 class IncrOpIndexedNode : public AstNode { | 761 class IncrOpIndexedNode : public AstNode { |
| 820 public: | 762 public: |
| 821 IncrOpIndexedNode(intptr_t token_index, | 763 IncrOpIndexedNode(intptr_t token_index, |
| 822 Token::Kind kind, | 764 Token::Kind kind, |
| 823 bool prefix, | 765 bool prefix, |
| 824 AstNode* array, | 766 AstNode* array, |
| 825 AstNode* index) | 767 AstNode* index) |
| 826 : AstNode(token_index), | 768 : AstNode(token_index), |
| 827 kind_(kind), | 769 kind_(kind), |
| 828 prefix_(prefix), | 770 prefix_(prefix), |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 const LocalVariable& context_var_; | 1856 const LocalVariable& context_var_; |
| 1915 | 1857 |
| 1916 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1858 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1917 }; | 1859 }; |
| 1918 | 1860 |
| 1919 } // namespace dart | 1861 } // namespace dart |
| 1920 | 1862 |
| 1921 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1863 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1922 | 1864 |
| 1923 #endif // VM_AST_H_ | 1865 #endif // VM_AST_H_ |
| OLD | NEW |