| 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_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 HEAP_OBJECT_IMPLEMENTATION(Function, Object); | 1647 HEAP_OBJECT_IMPLEMENTATION(Function, Object); |
| 1648 friend class Class; | 1648 friend class Class; |
| 1649 }; | 1649 }; |
| 1650 | 1650 |
| 1651 | 1651 |
| 1652 class Field : public Object { | 1652 class Field : public Object { |
| 1653 public: | 1653 public: |
| 1654 RawString* name() const { return raw_ptr()->name_; } | 1654 RawString* name() const { return raw_ptr()->name_; } |
| 1655 bool is_static() const { return raw_ptr()->is_static_; } | 1655 bool is_static() const { return raw_ptr()->is_static_; } |
| 1656 bool is_final() const { return raw_ptr()->is_final_; } | 1656 bool is_final() const { return raw_ptr()->is_final_; } |
| 1657 // TODO(regis): Implement support for const fields. Until then, current final | 1657 bool is_const() const { return raw_ptr()->is_const_; } |
| 1658 // fields are considered const. | |
| 1659 bool is_const() const { return raw_ptr()->is_final_; } | |
| 1660 | 1658 |
| 1661 inline intptr_t Offset() const; | 1659 inline intptr_t Offset() const; |
| 1662 inline void SetOffset(intptr_t value) const; | 1660 inline void SetOffset(intptr_t value) const; |
| 1663 | 1661 |
| 1664 RawInstance* value() const; | 1662 RawInstance* value() const; |
| 1665 void set_value(const Instance& value) const; | 1663 void set_value(const Instance& value) const; |
| 1666 | 1664 |
| 1667 RawClass* owner() const { return raw_ptr()->owner_; } | 1665 RawClass* owner() const { return raw_ptr()->owner_; } |
| 1668 void set_owner(const Class& value) const { | 1666 void set_owner(const Class& value) const { |
| 1669 StorePointer(&raw_ptr()->owner_, value.raw()); | 1667 StorePointer(&raw_ptr()->owner_, value.raw()); |
| 1670 } | 1668 } |
| 1671 | 1669 |
| 1672 RawAbstractType* type() const { return raw_ptr()->type_; } | 1670 RawAbstractType* type() const { return raw_ptr()->type_; } |
| 1673 void set_type(const AbstractType& value) const; | 1671 void set_type(const AbstractType& value) const; |
| 1674 | 1672 |
| 1675 static intptr_t InstanceSize() { | 1673 static intptr_t InstanceSize() { |
| 1676 return RoundedAllocationSize(sizeof(RawField)); | 1674 return RoundedAllocationSize(sizeof(RawField)); |
| 1677 } | 1675 } |
| 1678 | 1676 |
| 1679 static RawField* New(const String& name, | 1677 static RawField* New(const String& name, |
| 1680 bool is_static, | 1678 bool is_static, |
| 1681 bool is_final, | 1679 bool is_final, |
| 1680 bool is_const, |
| 1682 intptr_t token_pos); | 1681 intptr_t token_pos); |
| 1683 | 1682 |
| 1684 static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } | 1683 static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } |
| 1685 | 1684 |
| 1686 intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 1685 intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 1687 | 1686 |
| 1688 bool has_initializer() const { return raw_ptr()->has_initializer_; } | 1687 bool has_initializer() const { return raw_ptr()->has_initializer_; } |
| 1689 void set_has_initializer(bool has_initializer) const { | 1688 void set_has_initializer(bool has_initializer) const { |
| 1690 raw_ptr()->has_initializer_ = has_initializer; | 1689 raw_ptr()->has_initializer_ = has_initializer; |
| 1691 } | 1690 } |
| 1692 | 1691 |
| 1693 // Constructs getter and setter names for fields and vice versa. | 1692 // Constructs getter and setter names for fields and vice versa. |
| 1694 static RawString* GetterName(const String& field_name); | 1693 static RawString* GetterName(const String& field_name); |
| 1695 static RawString* GetterSymbol(const String& field_name); | 1694 static RawString* GetterSymbol(const String& field_name); |
| 1696 static RawString* SetterName(const String& field_name); | 1695 static RawString* SetterName(const String& field_name); |
| 1697 static RawString* SetterSymbol(const String& field_name); | 1696 static RawString* SetterSymbol(const String& field_name); |
| 1698 static RawString* NameFromGetter(const String& getter_name); | 1697 static RawString* NameFromGetter(const String& getter_name); |
| 1699 static RawString* NameFromSetter(const String& setter_name); | 1698 static RawString* NameFromSetter(const String& setter_name); |
| 1700 static bool IsGetterName(const String& function_name); | 1699 static bool IsGetterName(const String& function_name); |
| 1701 static bool IsSetterName(const String& function_name); | 1700 static bool IsSetterName(const String& function_name); |
| 1702 | 1701 |
| 1703 private: | 1702 private: |
| 1704 void set_name(const String& value) const; | 1703 void set_name(const String& value) const; |
| 1705 void set_is_static(bool is_static) const { | 1704 void set_is_static(bool is_static) const { |
| 1706 raw_ptr()->is_static_ = is_static; | 1705 raw_ptr()->is_static_ = is_static; |
| 1707 } | 1706 } |
| 1708 void set_is_final(bool is_final) const { | 1707 void set_is_final(bool is_final) const { |
| 1709 raw_ptr()->is_final_ = is_final; | 1708 raw_ptr()->is_final_ = is_final; |
| 1710 } | 1709 } |
| 1710 void set_is_const(bool value) const { |
| 1711 raw_ptr()->is_const_ = value; |
| 1712 } |
| 1711 void set_token_pos(intptr_t token_pos) const { | 1713 void set_token_pos(intptr_t token_pos) const { |
| 1712 raw_ptr()->token_pos_ = token_pos; | 1714 raw_ptr()->token_pos_ = token_pos; |
| 1713 } | 1715 } |
| 1714 static RawField* New(); | 1716 static RawField* New(); |
| 1715 | 1717 |
| 1716 HEAP_OBJECT_IMPLEMENTATION(Field, Object); | 1718 HEAP_OBJECT_IMPLEMENTATION(Field, Object); |
| 1717 friend class Class; | 1719 friend class Class; |
| 1718 }; | 1720 }; |
| 1719 | 1721 |
| 1720 | 1722 |
| (...skipping 3485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5206 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5208 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5207 return false; | 5209 return false; |
| 5208 } | 5210 } |
| 5209 } | 5211 } |
| 5210 return true; | 5212 return true; |
| 5211 } | 5213 } |
| 5212 | 5214 |
| 5213 } // namespace dart | 5215 } // namespace dart |
| 5214 | 5216 |
| 5215 #endif // VM_OBJECT_H_ | 5217 #endif // VM_OBJECT_H_ |
| OLD | NEW |