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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 private: | 1107 private: |
1108 const Field& field_; | 1108 const Field& field_; |
1109 AstNode* value_; | 1109 AstNode* value_; |
1110 | 1110 |
1111 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); | 1111 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); |
1112 }; | 1112 }; |
1113 | 1113 |
1114 | 1114 |
1115 class LoadIndexedNode : public AstNode { | 1115 class LoadIndexedNode : public AstNode { |
1116 public: | 1116 public: |
1117 LoadIndexedNode(intptr_t token_pos, AstNode* array, AstNode* index) | 1117 LoadIndexedNode(intptr_t token_pos, |
1118 : AstNode(token_pos), array_(array), index_expr_(index) { | 1118 AstNode* array, |
| 1119 AstNode* index, |
| 1120 const Class& super_class) |
| 1121 : AstNode(token_pos), |
| 1122 array_(array), |
| 1123 index_expr_(index), |
| 1124 super_class_(super_class) { |
1119 ASSERT(array_ != NULL); | 1125 ASSERT(array_ != NULL); |
1120 ASSERT(index_expr_ != NULL); | 1126 ASSERT(index_expr_ != NULL); |
| 1127 ASSERT(super_class_.IsZoneHandle()); |
1121 } | 1128 } |
1122 | 1129 |
1123 AstNode* array() const { return array_; } | 1130 AstNode* array() const { return array_; } |
1124 AstNode* index_expr() const { return index_expr_; } | 1131 AstNode* index_expr() const { return index_expr_; } |
| 1132 const Class& super_class() const { return super_class_; } |
| 1133 bool IsSuperLoad() const { return !super_class_.IsNull(); } |
1125 | 1134 |
1126 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1135 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1127 array()->Visit(visitor); | 1136 array()->Visit(visitor); |
1128 index_expr()->Visit(visitor); | 1137 index_expr()->Visit(visitor); |
1129 } | 1138 } |
1130 | 1139 |
1131 virtual AstNode* MakeAssignmentNode(AstNode* rhs); | 1140 virtual AstNode* MakeAssignmentNode(AstNode* rhs); |
1132 | 1141 |
1133 DECLARE_COMMON_NODE_FUNCTIONS(LoadIndexedNode); | 1142 DECLARE_COMMON_NODE_FUNCTIONS(LoadIndexedNode); |
1134 | 1143 |
1135 private: | 1144 private: |
1136 AstNode* array_; | 1145 AstNode* array_; |
1137 AstNode* index_expr_; | 1146 AstNode* index_expr_; |
| 1147 const Class& super_class_; |
1138 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); | 1148 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); |
1139 }; | 1149 }; |
1140 | 1150 |
1141 | 1151 |
1142 class StoreIndexedNode : public AstNode { | 1152 class StoreIndexedNode : public AstNode { |
1143 public: | 1153 public: |
1144 StoreIndexedNode(intptr_t token_pos, | 1154 StoreIndexedNode(intptr_t token_pos, |
1145 AstNode* array, AstNode* index, AstNode* value) | 1155 AstNode* array, |
1146 : AstNode(token_pos), array_(array), index_expr_(index), value_(value) { | 1156 AstNode* index, |
| 1157 AstNode* value, |
| 1158 const Class& super_class) |
| 1159 : AstNode(token_pos), |
| 1160 array_(array), |
| 1161 index_expr_(index), |
| 1162 value_(value), |
| 1163 super_class_(super_class) { |
1147 ASSERT(array_ != NULL); | 1164 ASSERT(array_ != NULL); |
1148 ASSERT(index_expr_ != NULL); | 1165 ASSERT(index_expr_ != NULL); |
1149 ASSERT(value_ != NULL); | 1166 ASSERT(value_ != NULL); |
| 1167 ASSERT(super_class_.IsZoneHandle()); |
1150 } | 1168 } |
1151 | 1169 |
1152 AstNode* array() const { return array_; } | 1170 AstNode* array() const { return array_; } |
1153 AstNode* index_expr() const { return index_expr_; } | 1171 AstNode* index_expr() const { return index_expr_; } |
1154 AstNode* value() const { return value_; } | 1172 AstNode* value() const { return value_; } |
| 1173 const Class& super_class() const { return super_class_; } |
| 1174 bool IsSuperStore() const { return !super_class_.IsNull(); } |
1155 | 1175 |
1156 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1176 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1157 array()->Visit(visitor); | 1177 array()->Visit(visitor); |
1158 index_expr()->Visit(visitor); | 1178 index_expr()->Visit(visitor); |
1159 value()->Visit(visitor); | 1179 value()->Visit(visitor); |
1160 } | 1180 } |
1161 | 1181 |
1162 DECLARE_COMMON_NODE_FUNCTIONS(StoreIndexedNode); | 1182 DECLARE_COMMON_NODE_FUNCTIONS(StoreIndexedNode); |
1163 | 1183 |
1164 private: | 1184 private: |
1165 AstNode* array_; | 1185 AstNode* array_; |
1166 AstNode* index_expr_; | 1186 AstNode* index_expr_; |
1167 AstNode* value_; | 1187 AstNode* value_; |
| 1188 const Class& super_class_; |
1168 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode); | 1189 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode); |
1169 }; | 1190 }; |
1170 | 1191 |
1171 | 1192 |
1172 class InstanceCallNode : public AstNode { | 1193 class InstanceCallNode : public AstNode { |
1173 public: | 1194 public: |
1174 InstanceCallNode(intptr_t token_pos, | 1195 InstanceCallNode(intptr_t token_pos, |
1175 AstNode* receiver, | 1196 AstNode* receiver, |
1176 const String& function_name, | 1197 const String& function_name, |
1177 ArgumentListNode* arguments) | 1198 ArgumentListNode* arguments) |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 const LocalVariable& context_var_; | 1710 const LocalVariable& context_var_; |
1690 | 1711 |
1691 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1712 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1692 }; | 1713 }; |
1693 | 1714 |
1694 } // namespace dart | 1715 } // namespace dart |
1695 | 1716 |
1696 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1717 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1697 | 1718 |
1698 #endif // VM_AST_H_ | 1719 #endif // VM_AST_H_ |
OLD | NEW |