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 10878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10889 RawObject* Namespace::Lookup(const String& name) const { | 10889 RawObject* Namespace::Lookup(const String& name) const { |
| 10890 Zone* zone = Thread::Current()->zone(); | 10890 Zone* zone = Thread::Current()->zone(); |
| 10891 const Library& lib = Library::Handle(zone, library()); | 10891 const Library& lib = Library::Handle(zone, library()); |
| 10892 intptr_t ignore = 0; | 10892 intptr_t ignore = 0; |
| 10893 | 10893 |
| 10894 // Lookup the name in the library's symbols. | 10894 // Lookup the name in the library's symbols. |
| 10895 Object& obj = Object::Handle(zone, lib.LookupEntry(name, &ignore)); | 10895 Object& obj = Object::Handle(zone, lib.LookupEntry(name, &ignore)); |
| 10896 if (!Field::IsGetterName(name) && | 10896 if (!Field::IsGetterName(name) && |
| 10897 !Field::IsSetterName(name) && | 10897 !Field::IsSetterName(name) && |
| 10898 (obj.IsNull() || obj.IsLibraryPrefix())) { | 10898 (obj.IsNull() || obj.IsLibraryPrefix())) { |
| 10899 const String& getter_name = String::Handle(Field::LookupGetterSymbol(name)); | 10899 String& cname = String::Handle(zone); |
|
hausner
2016/04/06 22:27:19
cname looks very much like name. How about acc_nam
siva
2016/04/06 23:02:49
Done, used accessor_name
| |
| 10900 if (!getter_name.IsNull()) { | 10900 cname ^= Field::LookupGetterSymbol(name); |
| 10901 obj = lib.LookupEntry(getter_name, &ignore); | 10901 if (!cname.IsNull()) { |
| 10902 obj = lib.LookupEntry(cname, &ignore); | |
| 10902 } | 10903 } |
| 10903 if (obj.IsNull()) { | 10904 if (obj.IsNull()) { |
| 10904 const String& setter_name = | 10905 cname ^= Field::LookupSetterSymbol(name); |
| 10905 String::Handle(Field::LookupSetterSymbol(name)); | 10906 if (!cname.IsNull()) { |
| 10906 if (!setter_name.IsNull()) { | 10907 obj = lib.LookupEntry(cname, &ignore); |
| 10907 obj = lib.LookupEntry(setter_name, &ignore); | |
| 10908 } | 10908 } |
| 10909 } | 10909 } |
| 10910 } | 10910 } |
| 10911 | 10911 |
| 10912 // Library prefixes are not exported. | 10912 // Library prefixes are not exported. |
| 10913 if (obj.IsNull() || obj.IsLibraryPrefix()) { | 10913 if (obj.IsNull() || obj.IsLibraryPrefix()) { |
| 10914 // Lookup in the re-exported symbols. | 10914 // Lookup in the re-exported symbols. |
| 10915 obj = lib.LookupReExport(name); | 10915 obj = lib.LookupReExport(name); |
| 10916 if (obj.IsNull() && !Field::IsSetterName(name)) { | 10916 if (obj.IsNull() && !Field::IsSetterName(name)) { |
| 10917 // LookupReExport() only returns objects that match the given name. | 10917 // LookupReExport() only returns objects that match the given name. |
| 10918 // If there is no field/func/getter, try finding a setter. | 10918 // If there is no field/func/getter, try finding a setter. |
| 10919 const String& setter_name = | 10919 const String& setter_name = |
| 10920 String::Handle(Field::LookupSetterSymbol(name)); | 10920 String::Handle(zone, Field::LookupSetterSymbol(name)); |
| 10921 if (!setter_name.IsNull()) { | 10921 if (!setter_name.IsNull()) { |
| 10922 obj = lib.LookupReExport(setter_name); | 10922 obj = lib.LookupReExport(setter_name); |
| 10923 } | 10923 } |
| 10924 } | 10924 } |
| 10925 } | 10925 } |
| 10926 if (obj.IsNull() || HidesName(name) || obj.IsLibraryPrefix()) { | 10926 if (obj.IsNull() || HidesName(name) || obj.IsLibraryPrefix()) { |
| 10927 return Object::null(); | 10927 return Object::null(); |
| 10928 } | 10928 } |
| 10929 return obj.raw(); | 10929 return obj.raw(); |
| 10930 } | 10930 } |
| (...skipping 10950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 21881 return UserTag::null(); | 21881 return UserTag::null(); |
| 21882 } | 21882 } |
| 21883 | 21883 |
| 21884 | 21884 |
| 21885 const char* UserTag::ToCString() const { | 21885 const char* UserTag::ToCString() const { |
| 21886 const String& tag_label = String::Handle(label()); | 21886 const String& tag_label = String::Handle(label()); |
| 21887 return tag_label.ToCString(); | 21887 return tag_label.ToCString(); |
| 21888 } | 21888 } |
| 21889 | 21889 |
| 21890 } // namespace dart | 21890 } // namespace dart |
| OLD | NEW |