| 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 10893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10904 RawObject* Namespace::Lookup(const String& name) const { | 10904 RawObject* Namespace::Lookup(const String& name) const { |
| 10905 Zone* zone = Thread::Current()->zone(); | 10905 Zone* zone = Thread::Current()->zone(); |
| 10906 const Library& lib = Library::Handle(zone, library()); | 10906 const Library& lib = Library::Handle(zone, library()); |
| 10907 intptr_t ignore = 0; | 10907 intptr_t ignore = 0; |
| 10908 | 10908 |
| 10909 // Lookup the name in the library's symbols. | 10909 // Lookup the name in the library's symbols. |
| 10910 Object& obj = Object::Handle(zone, lib.LookupEntry(name, &ignore)); | 10910 Object& obj = Object::Handle(zone, lib.LookupEntry(name, &ignore)); |
| 10911 if (!Field::IsGetterName(name) && | 10911 if (!Field::IsGetterName(name) && |
| 10912 !Field::IsSetterName(name) && | 10912 !Field::IsSetterName(name) && |
| 10913 (obj.IsNull() || obj.IsLibraryPrefix())) { | 10913 (obj.IsNull() || obj.IsLibraryPrefix())) { |
| 10914 const String& getter_name = String::Handle(Field::LookupGetterSymbol(name)); | 10914 String& accessor_name = String::Handle(zone); |
| 10915 if (!getter_name.IsNull()) { | 10915 accessor_name ^= Field::LookupGetterSymbol(name); |
| 10916 obj = lib.LookupEntry(getter_name, &ignore); | 10916 if (!accessor_name.IsNull()) { |
| 10917 obj = lib.LookupEntry(accessor_name, &ignore); |
| 10917 } | 10918 } |
| 10918 if (obj.IsNull()) { | 10919 if (obj.IsNull()) { |
| 10919 const String& setter_name = | 10920 accessor_name ^= Field::LookupSetterSymbol(name); |
| 10920 String::Handle(Field::LookupSetterSymbol(name)); | 10921 if (!accessor_name.IsNull()) { |
| 10921 if (!setter_name.IsNull()) { | 10922 obj = lib.LookupEntry(accessor_name, &ignore); |
| 10922 obj = lib.LookupEntry(setter_name, &ignore); | |
| 10923 } | 10923 } |
| 10924 } | 10924 } |
| 10925 } | 10925 } |
| 10926 | 10926 |
| 10927 // Library prefixes are not exported. | 10927 // Library prefixes are not exported. |
| 10928 if (obj.IsNull() || obj.IsLibraryPrefix()) { | 10928 if (obj.IsNull() || obj.IsLibraryPrefix()) { |
| 10929 // Lookup in the re-exported symbols. | 10929 // Lookup in the re-exported symbols. |
| 10930 obj = lib.LookupReExport(name); | 10930 obj = lib.LookupReExport(name); |
| 10931 if (obj.IsNull() && !Field::IsSetterName(name)) { | 10931 if (obj.IsNull() && !Field::IsSetterName(name)) { |
| 10932 // LookupReExport() only returns objects that match the given name. | 10932 // LookupReExport() only returns objects that match the given name. |
| 10933 // If there is no field/func/getter, try finding a setter. | 10933 // If there is no field/func/getter, try finding a setter. |
| 10934 const String& setter_name = | 10934 const String& setter_name = |
| 10935 String::Handle(Field::LookupSetterSymbol(name)); | 10935 String::Handle(zone, Field::LookupSetterSymbol(name)); |
| 10936 if (!setter_name.IsNull()) { | 10936 if (!setter_name.IsNull()) { |
| 10937 obj = lib.LookupReExport(setter_name); | 10937 obj = lib.LookupReExport(setter_name); |
| 10938 } | 10938 } |
| 10939 } | 10939 } |
| 10940 } | 10940 } |
| 10941 if (obj.IsNull() || HidesName(name) || obj.IsLibraryPrefix()) { | 10941 if (obj.IsNull() || HidesName(name) || obj.IsLibraryPrefix()) { |
| 10942 return Object::null(); | 10942 return Object::null(); |
| 10943 } | 10943 } |
| 10944 return obj.raw(); | 10944 return obj.raw(); |
| 10945 } | 10945 } |
| (...skipping 10951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21897 return UserTag::null(); | 21897 return UserTag::null(); |
| 21898 } | 21898 } |
| 21899 | 21899 |
| 21900 | 21900 |
| 21901 const char* UserTag::ToCString() const { | 21901 const char* UserTag::ToCString() const { |
| 21902 const String& tag_label = String::Handle(label()); | 21902 const String& tag_label = String::Handle(label()); |
| 21903 return tag_label.ToCString(); | 21903 return tag_label.ToCString(); |
| 21904 } | 21904 } |
| 21905 | 21905 |
| 21906 } // namespace dart | 21906 } // namespace dart |
| OLD | NEW |