| 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 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/become.h" | 10 #include "vm/become.h" |
| (...skipping 9776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9787 entryname = entry.name(); | 9787 entryname = entry.name(); |
| 9788 if (entryname.Equals(metaname)) { | 9788 if (entryname.Equals(metaname)) { |
| 9789 return entry.raw(); | 9789 return entry.raw(); |
| 9790 } | 9790 } |
| 9791 } | 9791 } |
| 9792 return Field::null(); | 9792 return Field::null(); |
| 9793 } | 9793 } |
| 9794 | 9794 |
| 9795 | 9795 |
| 9796 RawObject* Library::GetMetadata(const Object& obj) const { | 9796 RawObject* Library::GetMetadata(const Object& obj) const { |
| 9797 #if defined(DART_PRECOMPILED_RUNTIME) |
| 9798 COMPILE_ASSERT(!FLAG_enable_mirrors); |
| 9799 return Object::empty_array().raw(); |
| 9800 #else |
| 9797 if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() && | 9801 if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() && |
| 9798 !obj.IsLibrary() && !obj.IsTypeParameter()) { | 9802 !obj.IsLibrary() && !obj.IsTypeParameter()) { |
| 9799 return Object::null(); | 9803 return Object::null(); |
| 9800 } | 9804 } |
| 9801 const String& metaname = String::Handle(MakeMetadataName(obj)); | 9805 const String& metaname = String::Handle(MakeMetadataName(obj)); |
| 9802 Field& field = Field::Handle(GetMetadataField(metaname)); | 9806 Field& field = Field::Handle(GetMetadataField(metaname)); |
| 9803 if (field.IsNull()) { | 9807 if (field.IsNull()) { |
| 9804 // There is no metadata for this object. | 9808 // There is no metadata for this object. |
| 9805 return Object::empty_array().raw(); | 9809 return Object::empty_array().raw(); |
| 9806 } | 9810 } |
| 9807 Object& metadata = Object::Handle(); | 9811 Object& metadata = Object::Handle(); |
| 9808 metadata = field.StaticValue(); | 9812 metadata = field.StaticValue(); |
| 9809 if (field.StaticValue() == Object::empty_array().raw()) { | 9813 if (field.StaticValue() == Object::empty_array().raw()) { |
| 9810 kernel::TreeNode* kernel_node = | 9814 kernel::TreeNode* kernel_node = |
| 9811 reinterpret_cast<kernel::TreeNode*>(field.kernel_field()); | 9815 reinterpret_cast<kernel::TreeNode*>(field.kernel_field()); |
| 9812 | 9816 |
| 9813 if (kernel_node != NULL) { | 9817 if (kernel_node != NULL) { |
| 9814 metadata = kernel::EvaluateMetadata(kernel_node); | 9818 metadata = kernel::EvaluateMetadata(kernel_node); |
| 9815 } else { | 9819 } else { |
| 9816 metadata = Parser::ParseMetadata(field); | 9820 metadata = Parser::ParseMetadata(field); |
| 9817 } | 9821 } |
| 9818 if (metadata.IsArray()) { | 9822 if (metadata.IsArray()) { |
| 9819 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); | 9823 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); |
| 9820 field.SetStaticValue(Array::Cast(metadata), true); | 9824 field.SetStaticValue(Array::Cast(metadata), true); |
| 9821 } | 9825 } |
| 9822 } | 9826 } |
| 9823 return metadata.raw(); | 9827 return metadata.raw(); |
| 9828 #endif // defined(DART_PRECOMPILED_RUNTIME) |
| 9824 } | 9829 } |
| 9825 | 9830 |
| 9826 | 9831 |
| 9827 static bool ShouldBePrivate(const String& name) { | 9832 static bool ShouldBePrivate(const String& name) { |
| 9828 return (name.Length() >= 1 && name.CharAt(0) == '_') || | 9833 return (name.Length() >= 1 && name.CharAt(0) == '_') || |
| 9829 (name.Length() >= 5 && | 9834 (name.Length() >= 5 && |
| 9830 (name.CharAt(4) == '_' && | 9835 (name.CharAt(4) == '_' && |
| 9831 (name.CharAt(0) == 'g' || name.CharAt(0) == 's') && | 9836 (name.CharAt(0) == 'g' || name.CharAt(0) == 's') && |
| 9832 name.CharAt(1) == 'e' && name.CharAt(2) == 't' && | 9837 name.CharAt(1) == 'e' && name.CharAt(2) == 't' && |
| 9833 name.CharAt(3) == ':')); | 9838 name.CharAt(3) == ':')); |
| (...skipping 13178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23012 return UserTag::null(); | 23017 return UserTag::null(); |
| 23013 } | 23018 } |
| 23014 | 23019 |
| 23015 | 23020 |
| 23016 const char* UserTag::ToCString() const { | 23021 const char* UserTag::ToCString() const { |
| 23017 const String& tag_label = String::Handle(label()); | 23022 const String& tag_label = String::Handle(label()); |
| 23018 return tag_label.ToCString(); | 23023 return tag_label.ToCString(); |
| 23019 } | 23024 } |
| 23020 | 23025 |
| 23021 } // namespace dart | 23026 } // namespace dart |
| OLD | NEW |