| 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 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 const Field& field_; | 1517 const Field& field_; |
| 1518 | 1518 |
| 1519 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldNode); | 1519 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldNode); |
| 1520 }; | 1520 }; |
| 1521 | 1521 |
| 1522 | 1522 |
| 1523 class StaticGetterNode : public AstNode { | 1523 class StaticGetterNode : public AstNode { |
| 1524 public: | 1524 public: |
| 1525 StaticGetterNode(intptr_t token_pos, | 1525 StaticGetterNode(intptr_t token_pos, |
| 1526 AstNode* receiver, | 1526 AstNode* receiver, |
| 1527 bool is_super_getter, | |
| 1528 const Class& cls, | 1527 const Class& cls, |
| 1529 const String& field_name) | 1528 const String& field_name) |
| 1530 : AstNode(token_pos), | 1529 : AstNode(token_pos), |
| 1531 receiver_(receiver), | 1530 receiver_(receiver), |
| 1532 cls_(cls), | 1531 cls_(cls), |
| 1533 field_name_(field_name), | 1532 field_name_(field_name), |
| 1534 is_super_getter_(is_super_getter), | |
| 1535 is_deferred_reference_(false) { | 1533 is_deferred_reference_(false) { |
| 1536 ASSERT(cls_.IsZoneHandle()); | 1534 ASSERT(cls_.IsZoneHandle()); |
| 1537 ASSERT(field_name_.IsZoneHandle()); | 1535 ASSERT(field_name_.IsZoneHandle()); |
| 1538 ASSERT(field_name_.IsSymbol()); | 1536 ASSERT(field_name_.IsSymbol()); |
| 1539 } | 1537 } |
| 1540 | 1538 |
| 1541 // The receiver is required | 1539 // The receiver is required for a super getter (an instance method that |
| 1542 // 1) for a super getter (an instance method that is resolved at compile | 1540 // is resolved at compile time rather than at runtime). |
| 1543 // time rather than at runtime). | |
| 1544 // 2) when transforming this StaticGetterNode issued in a non-static | |
| 1545 // context to an InstanceSetterNode. This may occurs when we find a | |
| 1546 // static getter, but no field and no static setter are declared. | |
| 1547 AstNode* receiver() const { return receiver_; } | 1541 AstNode* receiver() const { return receiver_; } |
| 1548 const Class& cls() const { return cls_; } | 1542 const Class& cls() const { return cls_; } |
| 1549 const String& field_name() const { return field_name_; } | 1543 const String& field_name() const { return field_name_; } |
| 1550 bool is_super_getter() const { return is_super_getter_; } | 1544 bool is_super_getter() const { return receiver_ != NULL; } |
| 1551 void set_is_deferred(bool value) { is_deferred_reference_ = value; } | 1545 void set_is_deferred(bool value) { is_deferred_reference_ = value; } |
| 1552 | 1546 |
| 1553 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 1547 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
| 1554 | 1548 |
| 1555 virtual AstNode* MakeAssignmentNode(AstNode* rhs); | 1549 virtual AstNode* MakeAssignmentNode(AstNode* rhs); |
| 1556 | 1550 |
| 1557 virtual bool IsPotentiallyConst() const; | 1551 virtual bool IsPotentiallyConst() const; |
| 1558 virtual const Instance* EvalConstExpr() const; | 1552 virtual const Instance* EvalConstExpr() const; |
| 1559 | 1553 |
| 1560 DECLARE_COMMON_NODE_FUNCTIONS(StaticGetterNode); | 1554 DECLARE_COMMON_NODE_FUNCTIONS(StaticGetterNode); |
| 1561 | 1555 |
| 1562 private: | 1556 private: |
| 1563 AstNode* receiver_; | 1557 AstNode* receiver_; |
| 1564 const Class& cls_; | 1558 const Class& cls_; |
| 1565 const String& field_name_; | 1559 const String& field_name_; |
| 1566 const bool is_super_getter_; | |
| 1567 bool is_deferred_reference_; | 1560 bool is_deferred_reference_; |
| 1568 | 1561 |
| 1569 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); | 1562 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); |
| 1570 }; | 1563 }; |
| 1571 | 1564 |
| 1572 | 1565 |
| 1573 class StaticSetterNode : public AstNode { | 1566 class StaticSetterNode : public AstNode { |
| 1574 public: | 1567 public: |
| 1575 StaticSetterNode(intptr_t token_pos, | 1568 StaticSetterNode(intptr_t token_pos, |
| 1576 AstNode* receiver, | 1569 AstNode* receiver, |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 const intptr_t try_index_; | 1940 const intptr_t try_index_; |
| 1948 | 1941 |
| 1949 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1942 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1950 }; | 1943 }; |
| 1951 | 1944 |
| 1952 } // namespace dart | 1945 } // namespace dart |
| 1953 | 1946 |
| 1954 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1947 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1955 | 1948 |
| 1956 #endif // VM_AST_H_ | 1949 #endif // VM_AST_H_ |
| OLD | NEW |