| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #define DECLARE_COMMON_NODE_FUNCTIONS(type) \ | 85 #define DECLARE_COMMON_NODE_FUNCTIONS(type) \ |
| 86 virtual void Visit(AstNodeVisitor* visitor); \ | 86 virtual void Visit(AstNodeVisitor* visitor); \ |
| 87 virtual const char* ShortName() const; \ | 87 virtual const char* ShortName() const; \ |
| 88 virtual bool Is##type() const { return true; } \ | 88 virtual bool Is##type() const { return true; } \ |
| 89 virtual type* As##type() { return this; } | 89 virtual type* As##type() { return this; } |
| 90 | 90 |
| 91 | 91 |
| 92 class AstNode : public ZoneAllocated { | 92 class AstNode : public ZoneAllocated { |
| 93 public: | 93 public: |
| 94 explicit AstNode(intptr_t token_pos) | 94 explicit AstNode(intptr_t token_pos) |
| 95 : token_pos_(token_pos), | 95 : token_pos_(token_pos) { |
| 96 ic_data_(ICData::ZoneHandle()) { | |
| 97 ASSERT(token_pos_ >= 0); | 96 ASSERT(token_pos_ >= 0); |
| 98 } | 97 } |
| 99 | 98 |
| 100 intptr_t token_pos() const { return token_pos_; } | 99 intptr_t token_pos() const { return token_pos_; } |
| 101 | 100 |
| 102 const ICData& ic_data() const { return ic_data_; } | |
| 103 void set_ic_data(const ICData& value) { | |
| 104 ic_data_ = value.raw(); | |
| 105 } | |
| 106 | |
| 107 #define AST_TYPE_CHECK(type, name) \ | 101 #define AST_TYPE_CHECK(type, name) \ |
| 108 virtual bool Is##type() const { return false; } \ | 102 virtual bool Is##type() const { return false; } \ |
| 109 virtual type* As##type() { return NULL; } | 103 virtual type* As##type() { return NULL; } |
| 110 NODE_LIST(AST_TYPE_CHECK) | 104 NODE_LIST(AST_TYPE_CHECK) |
| 111 #undef AST_TYPE_CHECK | 105 #undef AST_TYPE_CHECK |
| 112 | 106 |
| 113 virtual void Visit(AstNodeVisitor* visitor) = 0; | 107 virtual void Visit(AstNodeVisitor* visitor) = 0; |
| 114 virtual void VisitChildren(AstNodeVisitor* visitor) const = 0; | 108 virtual void VisitChildren(AstNodeVisitor* visitor) const = 0; |
| 115 virtual const char* ShortName() const = 0; | 109 virtual const char* ShortName() const = 0; |
| 116 | 110 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 141 // corresponds to the type of the const expression and is either | 135 // corresponds to the type of the const expression and is either |
| 142 // Number, Integer, String, Bool, or anything else (not a subtype of | 136 // Number, Integer, String, Bool, or anything else (not a subtype of |
| 143 // the former). | 137 // the former). |
| 144 virtual const Instance* EvalConstExpr() const { return NULL; } | 138 virtual const Instance* EvalConstExpr() const { return NULL; } |
| 145 | 139 |
| 146 protected: | 140 protected: |
| 147 friend class ParsedFunction; | 141 friend class ParsedFunction; |
| 148 | 142 |
| 149 private: | 143 private: |
| 150 const intptr_t token_pos_; | 144 const intptr_t token_pos_; |
| 151 // IC data collected for this node. | |
| 152 ICData& ic_data_; | |
| 153 DISALLOW_COPY_AND_ASSIGN(AstNode); | 145 DISALLOW_COPY_AND_ASSIGN(AstNode); |
| 154 }; | 146 }; |
| 155 | 147 |
| 156 | 148 |
| 157 class SequenceNode : public AstNode { | 149 class SequenceNode : public AstNode { |
| 158 public: | 150 public: |
| 159 SequenceNode(intptr_t token_pos, LocalScope* scope) | 151 SequenceNode(intptr_t token_pos, LocalScope* scope) |
| 160 : AstNode(token_pos), | 152 : AstNode(token_pos), |
| 161 scope_(scope), | 153 scope_(scope), |
| 162 nodes_(4), | 154 nodes_(4), |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 const LocalVariable& context_var_; | 1690 const LocalVariable& context_var_; |
| 1699 | 1691 |
| 1700 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1692 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1701 }; | 1693 }; |
| 1702 | 1694 |
| 1703 } // namespace dart | 1695 } // namespace dart |
| 1704 | 1696 |
| 1705 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1697 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1706 | 1698 |
| 1707 #endif // VM_AST_H_ | 1699 #endif // VM_AST_H_ |
| OLD | NEW |