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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1231 const String& field_name_; | 1231 const String& field_name_; |
1232 AstNode* value_; | 1232 AstNode* value_; |
1233 | 1233 |
1234 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); | 1234 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); |
1235 }; | 1235 }; |
1236 | 1236 |
1237 | 1237 |
1238 class StaticGetterNode : public AstNode { | 1238 class StaticGetterNode : public AstNode { |
1239 public: | 1239 public: |
1240 StaticGetterNode(intptr_t token_pos, | 1240 StaticGetterNode(intptr_t token_pos, |
1241 AstNode* receiver, // Null if called from static context. | 1241 AstNode* receiver, // Null if called from static context. |
srdjan
2012/08/08 16:44:34
Change comment that it is maybe non-NULL even in s
hausner
2012/08/08 17:42:02
super getters are dynamic functions, so it's not a
| |
1242 bool is_super_getter, | |
1242 const Class& cls, | 1243 const Class& cls, |
1243 const String& field_name) | 1244 const String& field_name) |
1244 : AstNode(token_pos), | 1245 : AstNode(token_pos), |
1245 receiver_(receiver), | 1246 receiver_(receiver), |
1246 cls_(cls), | 1247 cls_(cls), |
1247 field_name_(field_name) { | 1248 field_name_(field_name), |
1249 is_super_getter_(is_super_getter) { | |
1248 ASSERT(cls_.IsZoneHandle()); | 1250 ASSERT(cls_.IsZoneHandle()); |
1249 ASSERT(field_name_.IsZoneHandle()); | 1251 ASSERT(field_name_.IsZoneHandle()); |
1250 ASSERT(field_name_.IsSymbol()); | 1252 ASSERT(field_name_.IsSymbol()); |
1251 } | 1253 } |
1252 | 1254 |
1253 // The receiver is required when transforming this StaticGetterNode issued in | 1255 // The receiver is required when transforming this StaticGetterNode issued in |
1254 // a non-static context to an InstanceSetterNode. This occurs when no field | 1256 // a non-static context to an InstanceSetterNode. This occurs when no field |
1255 // and no setter are declared. | 1257 // and no setter are declared. |
1256 AstNode* receiver() const { return receiver_; } | 1258 AstNode* receiver() const { return receiver_; } |
1257 const Class& cls() const { return cls_; } | 1259 const Class& cls() const { return cls_; } |
1258 const String& field_name() const { return field_name_; } | 1260 const String& field_name() const { return field_name_; } |
1261 const bool is_super_getter() const { return is_super_getter_; } | |
srdjan
2012/08/08 16:44:34
s/const bool/bool/
hausner
2012/08/08 17:42:02
Done.
| |
1259 | 1262 |
1260 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 1263 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
1261 | 1264 |
1262 virtual AstNode* MakeAssignmentNode(AstNode* rhs); | 1265 virtual AstNode* MakeAssignmentNode(AstNode* rhs); |
1263 | 1266 |
1264 virtual const Instance* EvalConstExpr() const; | 1267 virtual const Instance* EvalConstExpr() const; |
1265 | 1268 |
1266 DECLARE_COMMON_NODE_FUNCTIONS(StaticGetterNode); | 1269 DECLARE_COMMON_NODE_FUNCTIONS(StaticGetterNode); |
1267 | 1270 |
1268 private: | 1271 private: |
1269 AstNode* receiver_; | 1272 AstNode* receiver_; |
1270 const Class& cls_; | 1273 const Class& cls_; |
1271 const String& field_name_; | 1274 const String& field_name_; |
1275 bool is_super_getter_; | |
srdjan
2012/08/08 16:44:34
const
hausner
2012/08/08 17:42:02
Done.
| |
1272 | 1276 |
1273 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); | 1277 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); |
1274 }; | 1278 }; |
1275 | 1279 |
1276 | 1280 |
1277 class StaticSetterNode : public AstNode { | 1281 class StaticSetterNode : public AstNode { |
1278 public: | 1282 public: |
1279 StaticSetterNode(intptr_t token_pos, | 1283 StaticSetterNode(intptr_t token_pos, |
1284 AstNode* receiver, | |
srdjan
2012/08/08 16:44:34
In a brief comment explain the need for receiver.
hausner
2012/08/08 17:42:02
Done.
| |
1280 const Class& cls, | 1285 const Class& cls, |
1281 const String& field_name, | 1286 const String& field_name, |
1282 AstNode* value) | 1287 AstNode* value) |
1283 : AstNode(token_pos), | 1288 : AstNode(token_pos), |
1289 receiver_(receiver), | |
1284 cls_(cls), | 1290 cls_(cls), |
1285 field_name_(field_name), | 1291 field_name_(field_name), |
1286 value_(value) { | 1292 value_(value) { |
1287 ASSERT(cls_.IsZoneHandle()); | 1293 ASSERT(cls_.IsZoneHandle()); |
1288 ASSERT(field_name_.IsZoneHandle()); | 1294 ASSERT(field_name_.IsZoneHandle()); |
1289 ASSERT(value_ != NULL); | 1295 ASSERT(value_ != NULL); |
1290 } | 1296 } |
1291 | 1297 |
1298 AstNode* receiver() const { return receiver_; } | |
1292 const Class& cls() const { return cls_; } | 1299 const Class& cls() const { return cls_; } |
1293 const String& field_name() const { return field_name_; } | 1300 const String& field_name() const { return field_name_; } |
1294 AstNode* value() const { return value_; } | 1301 AstNode* value() const { return value_; } |
1295 | 1302 |
1296 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1303 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1297 value()->Visit(visitor); | 1304 value()->Visit(visitor); |
1298 } | 1305 } |
1299 | 1306 |
1300 DECLARE_COMMON_NODE_FUNCTIONS(StaticSetterNode); | 1307 DECLARE_COMMON_NODE_FUNCTIONS(StaticSetterNode); |
1301 | 1308 |
1302 private: | 1309 private: |
1310 AstNode* receiver_; | |
1303 const Class& cls_; | 1311 const Class& cls_; |
1304 const String& field_name_; | 1312 const String& field_name_; |
1305 AstNode* value_; | 1313 AstNode* value_; |
1306 | 1314 |
1307 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticSetterNode); | 1315 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticSetterNode); |
1308 }; | 1316 }; |
1309 | 1317 |
1310 | 1318 |
1311 class StaticCallNode : public AstNode { | 1319 class StaticCallNode : public AstNode { |
1312 public: | 1320 public: |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1636 const LocalVariable& context_var_; | 1644 const LocalVariable& context_var_; |
1637 | 1645 |
1638 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1646 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1639 }; | 1647 }; |
1640 | 1648 |
1641 } // namespace dart | 1649 } // namespace dart |
1642 | 1650 |
1643 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1651 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1644 | 1652 |
1645 #endif // VM_AST_H_ | 1653 #endif // VM_AST_H_ |
OLD | NEW |