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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 V(CoreLibrary, int, _throwFormatException) \ | 152 V(CoreLibrary, int, _throwFormatException) \ |
153 V(CoreLibrary, int, _parse) \ | 153 V(CoreLibrary, int, _parse) \ |
154 V(CoreLibrary, StackTrace, _setupFullStackTrace) \ | 154 V(CoreLibrary, StackTrace, _setupFullStackTrace) \ |
155 | 155 |
156 | 156 |
157 static void MarkFunctionAsInvisible(const Library& lib, | 157 static void MarkFunctionAsInvisible(const Library& lib, |
158 const char* class_name, | 158 const char* class_name, |
159 const char* function_name) { | 159 const char* function_name) { |
160 ASSERT(!lib.IsNull()); | 160 ASSERT(!lib.IsNull()); |
161 const Class& cls = Class::Handle( | 161 const Class& cls = Class::Handle( |
162 lib.LookupClassAllowPrivate(String::Handle(String::New(class_name)))); | 162 lib.LookupClassAllowPrivate(String::Handle(String::New(class_name)), |
| 163 NULL)); // No ambiguity error expected. |
163 ASSERT(!cls.IsNull()); | 164 ASSERT(!cls.IsNull()); |
164 const Function& function = | 165 const Function& function = |
165 Function::Handle( | 166 Function::Handle( |
166 cls.LookupFunctionAllowPrivate( | 167 cls.LookupFunctionAllowPrivate( |
167 String::Handle(String::New(function_name)))); | 168 String::Handle(String::New(function_name)))); |
168 ASSERT(!function.IsNull()); | 169 ASSERT(!function.IsNull()); |
169 function.set_is_visible(false); | 170 function.set_is_visible(false); |
170 } | 171 } |
171 | 172 |
172 | 173 |
(...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 signature_function.set_signature_class(*this); | 2102 signature_function.set_signature_class(*this); |
2102 ASSERT(IsCanonicalSignatureClass()); | 2103 ASSERT(IsCanonicalSignatureClass()); |
2103 } | 2104 } |
2104 set_is_prefinalized(); | 2105 set_is_prefinalized(); |
2105 } | 2106 } |
2106 | 2107 |
2107 | 2108 |
2108 RawClass* Class::NewNativeWrapper(const Library& library, | 2109 RawClass* Class::NewNativeWrapper(const Library& library, |
2109 const String& name, | 2110 const String& name, |
2110 int field_count) { | 2111 int field_count) { |
2111 Class& cls = Class::Handle(library.LookupClass(name)); | 2112 String& ambiguity_error_msg = String::Handle(); |
| 2113 Class& cls = Class::Handle(library.LookupClass(name, &ambiguity_error_msg)); |
2112 if (cls.IsNull()) { | 2114 if (cls.IsNull()) { |
| 2115 if (!ambiguity_error_msg.IsNull()) { |
| 2116 return Class::null(); |
| 2117 } |
2113 cls = New(name, Script::Handle(), Scanner::kDummyTokenIndex); | 2118 cls = New(name, Script::Handle(), Scanner::kDummyTokenIndex); |
2114 cls.SetFields(Object::empty_array()); | 2119 cls.SetFields(Object::empty_array()); |
2115 cls.SetFunctions(Object::empty_array()); | 2120 cls.SetFunctions(Object::empty_array()); |
2116 // Set super class to Object. | 2121 // Set super class to Object. |
2117 cls.set_super_type(Type::Handle(Type::ObjectType())); | 2122 cls.set_super_type(Type::Handle(Type::ObjectType())); |
2118 // Compute instance size. First word contains a pointer to a properly | 2123 // Compute instance size. First word contains a pointer to a properly |
2119 // sized typed array once the first native field has been set. | 2124 // sized typed array once the first native field has been set. |
2120 intptr_t instance_size = sizeof(RawObject) + kWordSize; | 2125 intptr_t instance_size = sizeof(RawObject) + kWordSize; |
2121 cls.set_instance_size(RoundedAllocationSize(instance_size)); | 2126 cls.set_instance_size(RoundedAllocationSize(instance_size)); |
2122 cls.set_next_field_offset(instance_size); | 2127 cls.set_next_field_offset(instance_size); |
(...skipping 4501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6624 name.CharAt(0) == '_') || | 6629 name.CharAt(0) == '_') || |
6625 (name.Length() >= 5 && | 6630 (name.Length() >= 5 && |
6626 (name.CharAt(4) == '_' && | 6631 (name.CharAt(4) == '_' && |
6627 (name.CharAt(0) == 'g' || name.CharAt(0) == 's') && | 6632 (name.CharAt(0) == 'g' || name.CharAt(0) == 's') && |
6628 name.CharAt(1) == 'e' && | 6633 name.CharAt(1) == 'e' && |
6629 name.CharAt(2) == 't' && | 6634 name.CharAt(2) == 't' && |
6630 name.CharAt(3) == ':')); | 6635 name.CharAt(3) == ':')); |
6631 } | 6636 } |
6632 | 6637 |
6633 | 6638 |
6634 RawField* Library::LookupFieldAllowPrivate(const String& name) const { | 6639 RawField* Library::LookupFieldAllowPrivate(const String& name, |
6635 // First check if name is found in the local scope of the library. | 6640 String* ambiguity_error_msg) const { |
6636 Object& obj = Object::Handle(LookupLocalField(name)); | 6641 Object& obj = Object::Handle( |
6637 if (!obj.IsNull()) { | 6642 LookupObjectAllowPrivate(name, ambiguity_error_msg)); |
| 6643 if (obj.IsField()) { |
6638 return Field::Cast(obj).raw(); | 6644 return Field::Cast(obj).raw(); |
6639 } | 6645 } |
6640 | |
6641 // Do not look up private names in imported libraries. | |
6642 if (ShouldBePrivate(name)) { | |
6643 return Field::null(); | |
6644 } | |
6645 | |
6646 // Now check if name is found in any imported libs. | |
6647 const Array& imports = Array::Handle(this->imports()); | |
6648 Namespace& import = Namespace::Handle(); | |
6649 for (intptr_t j = 0; j < this->num_imports(); j++) { | |
6650 import ^= imports.At(j); | |
6651 obj = import.Lookup(name); | |
6652 if (!obj.IsNull() && obj.IsField()) { | |
6653 return Field::Cast(obj).raw(); | |
6654 } | |
6655 } | |
6656 return Field::null(); | 6646 return Field::null(); |
6657 } | 6647 } |
6658 | 6648 |
6659 | 6649 |
6660 RawField* Library::LookupLocalField(const String& name) const { | 6650 RawField* Library::LookupLocalField(const String& name) const { |
6661 Isolate* isolate = Isolate::Current(); | 6651 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); |
6662 Field& field = Field::Handle(isolate, Field::null()); | 6652 if (obj.IsField()) { |
6663 Object& obj = Object::Handle(isolate, Object::null()); | 6653 return Field::Cast(obj).raw(); |
6664 obj = LookupLocalObject(name); | |
6665 if (obj.IsNull() && ShouldBePrivate(name)) { | |
6666 String& private_name = String::Handle(isolate, PrivateName(name)); | |
6667 obj = LookupLocalObject(private_name); | |
6668 } | 6654 } |
6669 if (!obj.IsNull()) { | |
6670 if (obj.IsField()) { | |
6671 field ^= obj.raw(); | |
6672 return field.raw(); | |
6673 } | |
6674 } | |
6675 | |
6676 // No field found. | |
6677 return Field::null(); | 6655 return Field::null(); |
6678 } | 6656 } |
6679 | 6657 |
6680 | 6658 |
6681 RawFunction* Library::LookupFunctionAllowPrivate(const String& name) const { | 6659 RawFunction* Library::LookupFunctionAllowPrivate( |
6682 // First check if name is found in the local scope of the library. | 6660 const String& name, |
6683 Function& function = Function::Handle(LookupLocalFunction(name)); | 6661 String* ambiguity_error_msg) const { |
6684 if (!function.IsNull()) { | 6662 Object& obj = Object::Handle( |
6685 return function.raw(); | 6663 LookupObjectAllowPrivate(name, ambiguity_error_msg)); |
6686 } | 6664 if (obj.IsFunction()) { |
6687 | 6665 return Function::Cast(obj).raw(); |
6688 // Do not look up private names in imported libraries. | |
6689 if (ShouldBePrivate(name)) { | |
6690 return Function::null(); | |
6691 } | |
6692 | |
6693 // Now check if name is found in any imported libs. | |
6694 const Array& imports = Array::Handle(this->imports()); | |
6695 Namespace& import = Namespace::Handle(); | |
6696 Object& obj = Object::Handle(); | |
6697 for (intptr_t j = 0; j < this->num_imports(); j++) { | |
6698 import ^= imports.At(j); | |
6699 obj = import.Lookup(name); | |
6700 if (!obj.IsNull() && obj.IsFunction()) { | |
6701 function ^= obj.raw(); | |
6702 return function.raw(); | |
6703 } | |
6704 } | 6666 } |
6705 return Function::null(); | 6667 return Function::null(); |
6706 } | 6668 } |
6707 | 6669 |
6708 | 6670 |
6709 RawFunction* Library::LookupLocalFunction(const String& name) const { | 6671 RawFunction* Library::LookupLocalFunction(const String& name) const { |
| 6672 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); |
| 6673 if (obj.IsFunction()) { |
| 6674 return Function::Cast(obj).raw(); |
| 6675 } |
| 6676 return Function::null(); |
| 6677 } |
| 6678 |
| 6679 |
| 6680 RawObject* Library::LookupLocalObjectAllowPrivate(const String& name) const { |
6710 Isolate* isolate = Isolate::Current(); | 6681 Isolate* isolate = Isolate::Current(); |
6711 Object& obj = Object::Handle(isolate, Object::null()); | 6682 Object& obj = Object::Handle(isolate, Object::null()); |
6712 obj = LookupLocalObject(name); | 6683 obj = LookupLocalObject(name); |
6713 if (obj.IsNull() && ShouldBePrivate(name)) { | 6684 if (obj.IsNull() && ShouldBePrivate(name)) { |
6714 String& private_name = String::Handle(isolate, PrivateName(name)); | 6685 String& private_name = String::Handle(isolate, PrivateName(name)); |
6715 obj = LookupLocalObject(private_name); | 6686 obj = LookupLocalObject(private_name); |
6716 } | 6687 } |
6717 if (obj.IsFunction()) { | 6688 return obj.raw(); |
6718 return Function::Cast(obj).raw(); | |
6719 } | |
6720 | |
6721 // No function found. | |
6722 return Function::null(); | |
6723 } | 6689 } |
6724 | 6690 |
6725 | 6691 |
6726 // TODO(regis): This should take an Error* ambiguity_error parameter. | 6692 RawObject* Library::LookupObjectAllowPrivate( |
6727 RawObject* Library::LookupObject(const String& name) const { | 6693 const String& name, |
| 6694 String* ambiguity_error_msg) const { |
| 6695 // First check if name is found in the local scope of the library. |
| 6696 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); |
| 6697 if (!obj.IsNull()) { |
| 6698 return obj.raw(); |
| 6699 } |
| 6700 |
| 6701 // Do not look up private names in imported libraries. |
| 6702 if (ShouldBePrivate(name)) { |
| 6703 return Object::null(); |
| 6704 } |
| 6705 |
| 6706 // Now check if name is found in any imported libs. It is a compile-time error |
| 6707 // if the name is found in more than one import and actually used. |
| 6708 return LookupImportedObject(name, ambiguity_error_msg); |
| 6709 } |
| 6710 |
| 6711 |
| 6712 RawObject* Library::LookupObject(const String& name, |
| 6713 String* ambiguity_error_msg) const { |
6728 // First check if name is found in the local scope of the library. | 6714 // First check if name is found in the local scope of the library. |
6729 Object& obj = Object::Handle(LookupLocalObject(name)); | 6715 Object& obj = Object::Handle(LookupLocalObject(name)); |
6730 if (!obj.IsNull()) { | 6716 if (!obj.IsNull()) { |
6731 return obj.raw(); | 6717 return obj.raw(); |
6732 } | 6718 } |
6733 // Now check if name is found in any imported libs. | 6719 // Now check if name is found in any imported libs. It is a compile-time error |
6734 // TODO(regis): This does not seem correct. It should be an error if the name | 6720 // if the name is found in more than one import and actually used. |
6735 // is found in more than one import and actually used. | 6721 return LookupImportedObject(name, ambiguity_error_msg); |
6736 const Array& imports = Array::Handle(this->imports()); | |
6737 Namespace& import = Namespace::Handle(); | |
6738 for (intptr_t j = 0; j < this->num_imports(); j++) { | |
6739 import ^= imports.At(j); | |
6740 obj = import.Lookup(name); | |
6741 if (!obj.IsNull()) { | |
6742 return obj.raw(); | |
6743 } | |
6744 } | |
6745 return Object::null(); | |
6746 } | 6722 } |
6747 | 6723 |
6748 | 6724 |
6749 // TODO(regis): This should take an Error* ambiguity_error parameter. | 6725 RawObject* Library::LookupImportedObject(const String& name, |
6750 RawClass* Library::LookupClass(const String& name) const { | 6726 String* ambiguity_error_msg) const { |
6751 Object& obj = Object::Handle(LookupObject(name)); | 6727 Object& obj = Object::Handle(); |
6752 if (!obj.IsNull() && obj.IsClass()) { | 6728 Namespace& import = Namespace::Handle(); |
| 6729 Library& import_lib = Library::Handle(); |
| 6730 String& first_import_lib_url = String::Handle(); |
| 6731 Object& found_obj = Object::Handle(); |
| 6732 for (intptr_t i = 0; i < num_imports(); i++) { |
| 6733 import ^= ImportAt(i); |
| 6734 obj = import.Lookup(name); |
| 6735 if (!obj.IsNull()) { |
| 6736 import_lib = import.library(); |
| 6737 if (!first_import_lib_url.IsNull()) { |
| 6738 // Found duplicate definition. |
| 6739 const intptr_t kMessageBufferSize = 512; |
| 6740 char message_buffer[kMessageBufferSize]; |
| 6741 if (first_import_lib_url.raw() == url()) { |
| 6742 OS::SNPrint(message_buffer, |
| 6743 kMessageBufferSize, |
| 6744 "ambiguous reference to '%s', " |
| 6745 "as library '%s' is imported multiple times", |
| 6746 name.ToCString(), |
| 6747 first_import_lib_url.ToCString()); |
| 6748 } else { |
| 6749 OS::SNPrint(message_buffer, |
| 6750 kMessageBufferSize, |
| 6751 "ambiguous reference: " |
| 6752 "'%s' is defined in library '%s' and also in '%s'", |
| 6753 name.ToCString(), |
| 6754 first_import_lib_url.ToCString(), |
| 6755 String::Handle(url()).ToCString()); |
| 6756 } |
| 6757 // If the caller does not expect an ambiguity error, it may pass NULL as |
| 6758 // ambiguity_error_msg in order to avoid the allocation of a handle. |
| 6759 // It typically does so when looking up an object in the core library, |
| 6760 // which is guaranteed not to contain ambiguities, unless the core lib |
| 6761 // is under development, in which case the assert below may fail. |
| 6762 ASSERT(ambiguity_error_msg != NULL); // No ambiguity error expected. |
| 6763 *ambiguity_error_msg = String::New(message_buffer); |
| 6764 return Object::null(); |
| 6765 } |
| 6766 first_import_lib_url = url(); |
| 6767 found_obj = obj.raw(); |
| 6768 } |
| 6769 } |
| 6770 return found_obj.raw(); |
| 6771 } |
| 6772 |
| 6773 |
| 6774 RawClass* Library::LookupClass(const String& name, |
| 6775 String* ambiguity_error_msg) const { |
| 6776 Object& obj = Object::Handle(LookupObject(name, ambiguity_error_msg)); |
| 6777 if (obj.IsClass()) { |
6753 return Class::Cast(obj).raw(); | 6778 return Class::Cast(obj).raw(); |
6754 } | 6779 } |
6755 return Class::null(); | 6780 return Class::null(); |
6756 } | 6781 } |
6757 | 6782 |
6758 | 6783 |
6759 RawClass* Library::LookupLocalClass(const String& name) const { | 6784 RawClass* Library::LookupLocalClass(const String& name) const { |
6760 Object& obj = Object::Handle(LookupLocalObject(name)); | 6785 Object& obj = Object::Handle(LookupLocalObject(name)); |
6761 if (!obj.IsNull() && obj.IsClass()) { | 6786 if (obj.IsClass()) { |
6762 return Class::Cast(obj).raw(); | 6787 return Class::Cast(obj).raw(); |
6763 } | 6788 } |
6764 return Class::null(); | 6789 return Class::null(); |
6765 } | 6790 } |
6766 | 6791 |
6767 | 6792 |
6768 RawClass* Library::LookupClassAllowPrivate(const String& name) const { | 6793 RawClass* Library::LookupClassAllowPrivate(const String& name, |
| 6794 String* ambiguity_error_msg) const { |
6769 // See if the class is available in this library or in the top level | 6795 // See if the class is available in this library or in the top level |
6770 // scope of any imported library. | 6796 // scope of any imported library. |
6771 Isolate* isolate = Isolate::Current(); | 6797 Isolate* isolate = Isolate::Current(); |
6772 const Class& cls = Class::Handle(isolate, LookupClass(name)); | 6798 const Class& cls = Class::Handle(isolate, LookupClass(name, |
| 6799 ambiguity_error_msg)); |
6773 if (!cls.IsNull()) { | 6800 if (!cls.IsNull()) { |
6774 return cls.raw(); | 6801 return cls.raw(); |
6775 } | 6802 } |
6776 | 6803 |
6777 // Now try to lookup the class using its private name, but only in | 6804 // Now try to lookup the class using its private name, but only in |
6778 // this library (not in imported libraries). | 6805 // this library (not in imported libraries). |
6779 if (ShouldBePrivate(name)) { | 6806 if (ShouldBePrivate(name)) { |
6780 String& private_name = String::Handle(isolate, PrivateName(name)); | 6807 String& private_name = String::Handle(isolate, PrivateName(name)); |
6781 const Object& obj = Object::Handle(LookupLocalObject(private_name)); | 6808 const Object& obj = Object::Handle(LookupLocalObject(private_name)); |
6782 if (obj.IsClass()) { | 6809 if (obj.IsClass()) { |
6783 return Class::Cast(obj).raw(); | 6810 return Class::Cast(obj).raw(); |
6784 } | 6811 } |
6785 } | 6812 } |
6786 | |
6787 return Class::null(); | 6813 return Class::null(); |
6788 } | 6814 } |
6789 | 6815 |
6790 | 6816 |
6791 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { | 6817 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { |
6792 const Object& obj = Object::Handle(LookupLocalObject(name)); | 6818 const Object& obj = Object::Handle(LookupLocalObject(name)); |
6793 if (obj.IsLibraryPrefix()) { | 6819 if (obj.IsLibraryPrefix()) { |
6794 return LibraryPrefix::Cast(obj).raw(); | 6820 return LibraryPrefix::Cast(obj).raw(); |
6795 } | 6821 } |
6796 return LibraryPrefix::null(); | 6822 return LibraryPrefix::null(); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7199 if (num_current_imports >= length) { | 7225 if (num_current_imports >= length) { |
7200 const intptr_t new_length = length + kIncrementSize; | 7226 const intptr_t new_length = length + kIncrementSize; |
7201 imports = Array::Grow(imports, new_length, Heap::kOld); | 7227 imports = Array::Grow(imports, new_length, Heap::kOld); |
7202 set_imports(imports); | 7228 set_imports(imports); |
7203 } | 7229 } |
7204 imports.SetAt(num_current_imports, import); | 7230 imports.SetAt(num_current_imports, import); |
7205 set_num_imports(num_current_imports + 1); | 7231 set_num_imports(num_current_imports + 1); |
7206 } | 7232 } |
7207 | 7233 |
7208 | 7234 |
7209 RawClass* LibraryPrefix::LookupLocalClass(const String& class_name) const { | 7235 RawClass* LibraryPrefix::LookupClass(const String& class_name, |
| 7236 String* ambiguity_error_msg) const { |
7210 Array& imports = Array::Handle(this->imports()); | 7237 Array& imports = Array::Handle(this->imports()); |
7211 Object& obj = Object::Handle(); | 7238 Object& obj = Object::Handle(); |
7212 Namespace& import = Namespace::Handle(); | 7239 Namespace& import = Namespace::Handle(); |
| 7240 Library& import_lib = Library::Handle(); |
| 7241 String& first_import_lib_url = String::Handle(); |
| 7242 Object& found_obj = Object::Handle(); |
7213 for (intptr_t i = 0; i < num_imports(); i++) { | 7243 for (intptr_t i = 0; i < num_imports(); i++) { |
7214 import ^= imports.At(i); | 7244 import ^= imports.At(i); |
7215 obj = import.Lookup(class_name); | 7245 obj = import.Lookup(class_name); |
7216 if (!obj.IsNull() && obj.IsClass()) { | 7246 if (!obj.IsNull()) { |
7217 // TODO(hausner): | 7247 import_lib = import.library(); |
7218 return Class::Cast(obj).raw(); | 7248 if (!first_import_lib_url.IsNull()) { |
| 7249 // Found duplicate definition. |
| 7250 const intptr_t kMessageBufferSize = 512; |
| 7251 char message_buffer[kMessageBufferSize]; |
| 7252 if (first_import_lib_url.raw() == import_lib.url()) { |
| 7253 OS::SNPrint(message_buffer, |
| 7254 kMessageBufferSize, |
| 7255 "ambiguous reference to '%s', " |
| 7256 "as library '%s' is imported multiple times via " |
| 7257 "prefix '%s'", |
| 7258 class_name.ToCString(), |
| 7259 first_import_lib_url.ToCString(), |
| 7260 String::Handle(name()).ToCString()); |
| 7261 } else { |
| 7262 OS::SNPrint(message_buffer, |
| 7263 kMessageBufferSize, |
| 7264 "ambiguous reference: " |
| 7265 "'%s' is defined in library '%s' and also in '%s', " |
| 7266 "both imported via prefix '%s'", |
| 7267 class_name.ToCString(), |
| 7268 first_import_lib_url.ToCString(), |
| 7269 String::Handle(import_lib.url()).ToCString(), |
| 7270 String::Handle(name()).ToCString()); |
| 7271 } |
| 7272 // If the caller does not expect an ambiguity error, it may pass NULL as |
| 7273 // ambiguity_error_msg in order to avoid the allocation of a handle. |
| 7274 // It typically does so when looking up a class in the core library, |
| 7275 // which is guaranteed not to contain ambiguities, unless the core lib |
| 7276 // is under development, in which case the assert below may fail. |
| 7277 ASSERT(ambiguity_error_msg != NULL); // No ambiguity error expected. |
| 7278 *ambiguity_error_msg = String::New(message_buffer); |
| 7279 return Class::null(); |
| 7280 } |
| 7281 first_import_lib_url = import_lib.url(); |
| 7282 found_obj = obj.raw(); |
7219 } | 7283 } |
7220 } | 7284 } |
| 7285 if (found_obj.IsClass()) { |
| 7286 return Class::Cast(found_obj).raw(); |
| 7287 } |
7221 return Class::null(); | 7288 return Class::null(); |
7222 } | 7289 } |
7223 | 7290 |
7224 | 7291 |
7225 RawLibraryPrefix* LibraryPrefix::New() { | 7292 RawLibraryPrefix* LibraryPrefix::New() { |
7226 ASSERT(Object::library_prefix_class() != Class::null()); | 7293 ASSERT(Object::library_prefix_class() != Class::null()); |
7227 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, | 7294 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, |
7228 LibraryPrefix::InstanceSize(), | 7295 LibraryPrefix::InstanceSize(), |
7229 Heap::kOld); | 7296 Heap::kOld); |
7230 return reinterpret_cast<RawLibraryPrefix*>(raw); | 7297 return reinterpret_cast<RawLibraryPrefix*>(raw); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7408 Library& lib = Library::Handle(); | 7475 Library& lib = Library::Handle(); |
7409 Class& cls = Class::Handle(); | 7476 Class& cls = Class::Handle(); |
7410 Function& func = Function::Handle(); | 7477 Function& func = Function::Handle(); |
7411 String& str = String::Handle(); | 7478 String& str = String::Handle(); |
7412 bool has_errors = false; | 7479 bool has_errors = false; |
7413 | 7480 |
7414 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \ | 7481 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \ |
7415 func = Function::null(); \ | 7482 func = Function::null(); \ |
7416 if (strcmp(#class_name, "::") == 0) { \ | 7483 if (strcmp(#class_name, "::") == 0) { \ |
7417 str = Symbols::New(#function_name); \ | 7484 str = Symbols::New(#function_name); \ |
7418 func = lib.LookupFunctionAllowPrivate(str); \ | 7485 func = lib.LookupFunctionAllowPrivate(str, NULL); \ |
7419 } else { \ | 7486 } else { \ |
7420 str = String::New(#class_name); \ | 7487 str = String::New(#class_name); \ |
7421 cls = lib.LookupClassAllowPrivate(str); \ | 7488 cls = lib.LookupClassAllowPrivate(str, NULL); \ |
7422 if (!cls.IsNull()) { \ | 7489 if (!cls.IsNull()) { \ |
7423 if (#function_name[0] == '.') { \ | 7490 if (#function_name[0] == '.') { \ |
7424 str = String::New(#class_name#function_name); \ | 7491 str = String::New(#class_name#function_name); \ |
7425 } else { \ | 7492 } else { \ |
7426 str = String::New(#function_name); \ | 7493 str = String::New(#function_name); \ |
7427 } \ | 7494 } \ |
7428 func = cls.LookupFunctionAllowPrivate(str); \ | 7495 func = cls.LookupFunctionAllowPrivate(str); \ |
7429 } \ | 7496 } \ |
7430 } \ | 7497 } \ |
7431 if (!func.IsNull() && (func.SourceFingerprint() != fp)) { \ | 7498 if (!func.IsNull() && (func.SourceFingerprint() != fp)) { \ |
(...skipping 6857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14289 } | 14356 } |
14290 | 14357 |
14291 | 14358 |
14292 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14359 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
14293 stream->OpenObject(); | 14360 stream->OpenObject(); |
14294 stream->CloseObject(); | 14361 stream->CloseObject(); |
14295 } | 14362 } |
14296 | 14363 |
14297 | 14364 |
14298 } // namespace dart | 14365 } // namespace dart |
OLD | NEW |