| 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 "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 5172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5183 | 5183 |
| 5184 RawClass* Library::LookupLocalClass(const String& name) const { | 5184 RawClass* Library::LookupLocalClass(const String& name) const { |
| 5185 Object& obj = Object::Handle(LookupLocalObject(name)); | 5185 Object& obj = Object::Handle(LookupLocalObject(name)); |
| 5186 if (!obj.IsNull() && obj.IsClass()) { | 5186 if (!obj.IsNull() && obj.IsClass()) { |
| 5187 return Class::CheckedHandle(obj.raw()).raw(); | 5187 return Class::CheckedHandle(obj.raw()).raw(); |
| 5188 } | 5188 } |
| 5189 return Class::null(); | 5189 return Class::null(); |
| 5190 } | 5190 } |
| 5191 | 5191 |
| 5192 | 5192 |
| 5193 RawClass* Library::LookupClassAllowPrivate(const String& name) const { |
| 5194 // See if the class is available in this library or in the top level |
| 5195 // scope of any imported library. |
| 5196 Isolate* isolate = Isolate::Current(); |
| 5197 Class& cls = Class::Handle(isolate); |
| 5198 cls = LookupClass(name); |
| 5199 if (!cls.IsNull()) { |
| 5200 return cls.raw(); |
| 5201 } |
| 5202 |
| 5203 // Now try to lookup the class using its private name, but only in |
| 5204 // this library (not in imported libraries). |
| 5205 if (ShouldBePrivate(name)) { |
| 5206 String& private_name = String::Handle(isolate, PrivateName(name)); |
| 5207 const Object& obj = Object::Handle(LookupLocalObject(private_name)); |
| 5208 if (!obj.IsNull()) { |
| 5209 if (obj.IsClass()) { |
| 5210 cls ^= obj.raw(); |
| 5211 return cls.raw(); |
| 5212 } |
| 5213 } |
| 5214 } |
| 5215 |
| 5216 return Class::null(); |
| 5217 } |
| 5218 |
| 5219 |
| 5193 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { | 5220 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { |
| 5194 Object& obj = Object::Handle(LookupLocalObject(name)); | 5221 Object& obj = Object::Handle(LookupLocalObject(name)); |
| 5195 if (!obj.IsNull() && obj.IsLibraryPrefix()) { | 5222 if (!obj.IsNull() && obj.IsLibraryPrefix()) { |
| 5196 return LibraryPrefix::CheckedHandle(obj.raw()).raw(); | 5223 return LibraryPrefix::CheckedHandle(obj.raw()).raw(); |
| 5197 } | 5224 } |
| 5198 return LibraryPrefix::null(); | 5225 return LibraryPrefix::null(); |
| 5199 } | 5226 } |
| 5200 | 5227 |
| 5201 | 5228 |
| 5202 void Library::AddAnonymousClass(const Class& cls) const { | 5229 void Library::AddAnonymousClass(const Class& cls) const { |
| (...skipping 4816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10019 const String& str = String::Handle(pattern()); | 10046 const String& str = String::Handle(pattern()); |
| 10020 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10047 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10021 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10048 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10022 char* chars = reinterpret_cast<char*>( | 10049 char* chars = reinterpret_cast<char*>( |
| 10023 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10050 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10024 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10051 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10025 return chars; | 10052 return chars; |
| 10026 } | 10053 } |
| 10027 | 10054 |
| 10028 } // namespace dart | 10055 } // namespace dart |
| OLD | NEW |