Chromium Code Reviews| 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 ASSERT(ambiguity_error_msg != NULL); | |
|
siva
2013/07/22 22:21:46
The one issue with asserting here for the NULL is
regis
2013/07/22 23:51:27
As suggested, I changed the callers in tests to pa
| |
| 6758 *ambiguity_error_msg = String::New(message_buffer); | |
| 6759 return Object::null(); | |
| 6760 } | |
| 6761 first_import_lib_url = url(); | |
| 6762 found_obj = obj.raw(); | |
| 6763 } | |
| 6764 } | |
| 6765 return found_obj.raw(); | |
| 6766 } | |
| 6767 | |
| 6768 | |
| 6769 RawClass* Library::LookupClass(const String& name, | |
| 6770 String* ambiguity_error_msg) const { | |
| 6771 Object& obj = Object::Handle(LookupObject(name, ambiguity_error_msg)); | |
| 6772 if (obj.IsClass()) { | |
| 6753 return Class::Cast(obj).raw(); | 6773 return Class::Cast(obj).raw(); |
| 6754 } | 6774 } |
| 6755 return Class::null(); | 6775 return Class::null(); |
| 6756 } | 6776 } |
| 6757 | 6777 |
| 6758 | 6778 |
| 6759 RawClass* Library::LookupLocalClass(const String& name) const { | 6779 RawClass* Library::LookupLocalClass(const String& name) const { |
| 6760 Object& obj = Object::Handle(LookupLocalObject(name)); | 6780 Object& obj = Object::Handle(LookupLocalObject(name)); |
| 6761 if (!obj.IsNull() && obj.IsClass()) { | 6781 if (obj.IsClass()) { |
| 6762 return Class::Cast(obj).raw(); | 6782 return Class::Cast(obj).raw(); |
| 6763 } | 6783 } |
| 6764 return Class::null(); | 6784 return Class::null(); |
| 6765 } | 6785 } |
| 6766 | 6786 |
| 6767 | 6787 |
| 6768 RawClass* Library::LookupClassAllowPrivate(const String& name) const { | 6788 RawClass* Library::LookupClassAllowPrivate(const String& name, |
| 6789 String* ambiguity_error_msg) const { | |
| 6769 // See if the class is available in this library or in the top level | 6790 // See if the class is available in this library or in the top level |
| 6770 // scope of any imported library. | 6791 // scope of any imported library. |
| 6771 Isolate* isolate = Isolate::Current(); | 6792 Isolate* isolate = Isolate::Current(); |
| 6772 const Class& cls = Class::Handle(isolate, LookupClass(name)); | 6793 const Class& cls = Class::Handle(isolate, LookupClass(name, |
| 6794 ambiguity_error_msg)); | |
| 6773 if (!cls.IsNull()) { | 6795 if (!cls.IsNull()) { |
| 6774 return cls.raw(); | 6796 return cls.raw(); |
| 6775 } | 6797 } |
| 6776 | 6798 |
| 6777 // Now try to lookup the class using its private name, but only in | 6799 // Now try to lookup the class using its private name, but only in |
| 6778 // this library (not in imported libraries). | 6800 // this library (not in imported libraries). |
| 6779 if (ShouldBePrivate(name)) { | 6801 if (ShouldBePrivate(name)) { |
| 6780 String& private_name = String::Handle(isolate, PrivateName(name)); | 6802 String& private_name = String::Handle(isolate, PrivateName(name)); |
| 6781 const Object& obj = Object::Handle(LookupLocalObject(private_name)); | 6803 const Object& obj = Object::Handle(LookupLocalObject(private_name)); |
| 6782 if (obj.IsClass()) { | 6804 if (obj.IsClass()) { |
| 6783 return Class::Cast(obj).raw(); | 6805 return Class::Cast(obj).raw(); |
| 6784 } | 6806 } |
| 6785 } | 6807 } |
| 6786 | |
| 6787 return Class::null(); | 6808 return Class::null(); |
| 6788 } | 6809 } |
| 6789 | 6810 |
| 6790 | 6811 |
| 6791 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { | 6812 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { |
| 6792 const Object& obj = Object::Handle(LookupLocalObject(name)); | 6813 const Object& obj = Object::Handle(LookupLocalObject(name)); |
| 6793 if (obj.IsLibraryPrefix()) { | 6814 if (obj.IsLibraryPrefix()) { |
| 6794 return LibraryPrefix::Cast(obj).raw(); | 6815 return LibraryPrefix::Cast(obj).raw(); |
| 6795 } | 6816 } |
| 6796 return LibraryPrefix::null(); | 6817 return LibraryPrefix::null(); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7199 if (num_current_imports >= length) { | 7220 if (num_current_imports >= length) { |
| 7200 const intptr_t new_length = length + kIncrementSize; | 7221 const intptr_t new_length = length + kIncrementSize; |
| 7201 imports = Array::Grow(imports, new_length, Heap::kOld); | 7222 imports = Array::Grow(imports, new_length, Heap::kOld); |
| 7202 set_imports(imports); | 7223 set_imports(imports); |
| 7203 } | 7224 } |
| 7204 imports.SetAt(num_current_imports, import); | 7225 imports.SetAt(num_current_imports, import); |
| 7205 set_num_imports(num_current_imports + 1); | 7226 set_num_imports(num_current_imports + 1); |
| 7206 } | 7227 } |
| 7207 | 7228 |
| 7208 | 7229 |
| 7209 RawClass* LibraryPrefix::LookupLocalClass(const String& class_name) const { | 7230 RawClass* LibraryPrefix::LookupClass(const String& class_name, |
| 7231 String* ambiguity_error_msg) const { | |
| 7210 Array& imports = Array::Handle(this->imports()); | 7232 Array& imports = Array::Handle(this->imports()); |
| 7211 Object& obj = Object::Handle(); | 7233 Object& obj = Object::Handle(); |
| 7212 Namespace& import = Namespace::Handle(); | 7234 Namespace& import = Namespace::Handle(); |
| 7235 Library& import_lib = Library::Handle(); | |
| 7236 String& first_import_lib_url = String::Handle(); | |
| 7237 Object& found_obj = Object::Handle(); | |
| 7213 for (intptr_t i = 0; i < num_imports(); i++) { | 7238 for (intptr_t i = 0; i < num_imports(); i++) { |
| 7214 import ^= imports.At(i); | 7239 import ^= imports.At(i); |
| 7215 obj = import.Lookup(class_name); | 7240 obj = import.Lookup(class_name); |
| 7216 if (!obj.IsNull() && obj.IsClass()) { | 7241 if (!obj.IsNull()) { |
| 7217 // TODO(hausner): | 7242 import_lib = import.library(); |
| 7218 return Class::Cast(obj).raw(); | 7243 if (!first_import_lib_url.IsNull()) { |
| 7244 // Found duplicate definition. | |
| 7245 const intptr_t kMessageBufferSize = 512; | |
| 7246 char message_buffer[kMessageBufferSize]; | |
| 7247 if (first_import_lib_url.raw() == import_lib.url()) { | |
| 7248 OS::SNPrint(message_buffer, | |
| 7249 kMessageBufferSize, | |
| 7250 "ambiguous reference to '%s', " | |
| 7251 "as library '%s' is imported multiple times via " | |
| 7252 "prefix '%s'", | |
| 7253 class_name.ToCString(), | |
| 7254 first_import_lib_url.ToCString(), | |
| 7255 String::Handle(name()).ToCString()); | |
| 7256 } else { | |
| 7257 OS::SNPrint(message_buffer, | |
| 7258 kMessageBufferSize, | |
| 7259 "ambiguous reference: " | |
| 7260 "'%s' is defined in library '%s' and also in '%s', " | |
| 7261 "both imported via prefix '%s'", | |
| 7262 class_name.ToCString(), | |
| 7263 first_import_lib_url.ToCString(), | |
| 7264 String::Handle(import_lib.url()).ToCString(), | |
| 7265 String::Handle(name()).ToCString()); | |
| 7266 } | |
| 7267 ASSERT(ambiguity_error_msg != NULL); | |
| 7268 *ambiguity_error_msg = String::New(message_buffer); | |
| 7269 return Class::null(); | |
| 7270 } | |
| 7271 first_import_lib_url = import_lib.url(); | |
| 7272 found_obj = obj.raw(); | |
| 7219 } | 7273 } |
| 7220 } | 7274 } |
| 7275 if (found_obj.IsClass()) { | |
| 7276 return Class::Cast(found_obj).raw(); | |
| 7277 } | |
| 7221 return Class::null(); | 7278 return Class::null(); |
| 7222 } | 7279 } |
| 7223 | 7280 |
| 7224 | 7281 |
| 7225 RawLibraryPrefix* LibraryPrefix::New() { | 7282 RawLibraryPrefix* LibraryPrefix::New() { |
| 7226 ASSERT(Object::library_prefix_class() != Class::null()); | 7283 ASSERT(Object::library_prefix_class() != Class::null()); |
| 7227 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, | 7284 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, |
| 7228 LibraryPrefix::InstanceSize(), | 7285 LibraryPrefix::InstanceSize(), |
| 7229 Heap::kOld); | 7286 Heap::kOld); |
| 7230 return reinterpret_cast<RawLibraryPrefix*>(raw); | 7287 return reinterpret_cast<RawLibraryPrefix*>(raw); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7408 Library& lib = Library::Handle(); | 7465 Library& lib = Library::Handle(); |
| 7409 Class& cls = Class::Handle(); | 7466 Class& cls = Class::Handle(); |
| 7410 Function& func = Function::Handle(); | 7467 Function& func = Function::Handle(); |
| 7411 String& str = String::Handle(); | 7468 String& str = String::Handle(); |
| 7412 bool has_errors = false; | 7469 bool has_errors = false; |
| 7413 | 7470 |
| 7414 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \ | 7471 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \ |
| 7415 func = Function::null(); \ | 7472 func = Function::null(); \ |
| 7416 if (strcmp(#class_name, "::") == 0) { \ | 7473 if (strcmp(#class_name, "::") == 0) { \ |
| 7417 str = Symbols::New(#function_name); \ | 7474 str = Symbols::New(#function_name); \ |
| 7418 func = lib.LookupFunctionAllowPrivate(str); \ | 7475 func = lib.LookupFunctionAllowPrivate(str, NULL); \ |
| 7419 } else { \ | 7476 } else { \ |
| 7420 str = String::New(#class_name); \ | 7477 str = String::New(#class_name); \ |
| 7421 cls = lib.LookupClassAllowPrivate(str); \ | 7478 cls = lib.LookupClassAllowPrivate(str, NULL); \ |
| 7422 if (!cls.IsNull()) { \ | 7479 if (!cls.IsNull()) { \ |
| 7423 if (#function_name[0] == '.') { \ | 7480 if (#function_name[0] == '.') { \ |
| 7424 str = String::New(#class_name#function_name); \ | 7481 str = String::New(#class_name#function_name); \ |
| 7425 } else { \ | 7482 } else { \ |
| 7426 str = String::New(#function_name); \ | 7483 str = String::New(#function_name); \ |
| 7427 } \ | 7484 } \ |
| 7428 func = cls.LookupFunctionAllowPrivate(str); \ | 7485 func = cls.LookupFunctionAllowPrivate(str); \ |
| 7429 } \ | 7486 } \ |
| 7430 } \ | 7487 } \ |
| 7431 if (!func.IsNull() && (func.SourceFingerprint() != fp)) { \ | 7488 if (!func.IsNull() && (func.SourceFingerprint() != fp)) { \ |
| (...skipping 6839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14271 } | 14328 } |
| 14272 | 14329 |
| 14273 | 14330 |
| 14274 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14331 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14275 stream->OpenObject(); | 14332 stream->OpenObject(); |
| 14276 stream->CloseObject(); | 14333 stream->CloseObject(); |
| 14277 } | 14334 } |
| 14278 | 14335 |
| 14279 | 14336 |
| 14280 } // namespace dart | 14337 } // namespace dart |
| OLD | NEW |