| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 if (name.Equals(Symbols::TopLevel())) { | 218 if (name.Equals(Symbols::TopLevel())) { |
| 219 // Name of invisible top-level class. | 219 // Name of invisible top-level class. |
| 220 return Symbols::Empty().raw(); | 220 return Symbols::Empty().raw(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 // First remove all private name mangling. | 223 // First remove all private name mangling. |
| 224 String& unmangled_name = String::Handle(Symbols::Empty().raw()); | 224 String& unmangled_name = String::Handle(Symbols::Empty().raw()); |
| 225 String& segment = String::Handle(); | 225 String& segment = String::Handle(); |
| 226 intptr_t start_pos = 0; | 226 intptr_t start_pos = 0; |
| 227 for (intptr_t i = 0; i < name.Length(); i++) { | 227 for (intptr_t i = 0; i < name.Length(); i++) { |
| 228 if (name.CharAt(i) == '@') { | 228 if (name.CharAt(i) == '@' && |
| 229 (i+1) < name.Length() && |
| 230 (name.CharAt(i+1) >= '0') && |
| 231 (name.CharAt(i+1) <= '9')) { |
| 229 // Append the current segment to the unmangled name. | 232 // Append the current segment to the unmangled name. |
| 230 segment = String::SubString(name, start_pos, (i - start_pos)); | 233 segment = String::SubString(name, start_pos, (i - start_pos)); |
| 231 unmangled_name = String::Concat(unmangled_name, segment); | 234 unmangled_name = String::Concat(unmangled_name, segment); |
| 232 | 235 |
| 233 // Advance until past the name mangling. | 236 // Advance until past the name mangling. The private keys are only |
| 237 // numbers so we skip until the first non-number. |
| 234 i++; // Skip the '@'. | 238 i++; // Skip the '@'. |
| 235 while ((i < name.Length()) && | 239 while ((i < name.Length()) && |
| 236 (name.CharAt(i) != '&') && | 240 (name.CharAt(i) >= '0') && |
| 237 (name.CharAt(i) != '.')) { | 241 (name.CharAt(i) <= '9')) { |
| 238 i++; | 242 i++; |
| 239 } | 243 } |
| 240 start_pos = i; | 244 start_pos = i; |
| 241 i--; // Account for for-loop increment. | 245 i--; // Account for for-loop increment. |
| 242 } | 246 } |
| 243 } | 247 } |
| 244 if (start_pos == 0) { | 248 if (start_pos == 0) { |
| 245 // No name unmangling needed, reuse the name that was passed in. | 249 // No name unmangling needed, reuse the name that was passed in. |
| 246 unmangled_name = name.raw(); | 250 unmangled_name = name.raw(); |
| 247 } else if (name.Length() != start_pos) { | 251 } else if (name.Length() != start_pos) { |
| (...skipping 9052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9300 | 9304 |
| 9301 | 9305 |
| 9302 void Library::AllocatePrivateKey() const { | 9306 void Library::AllocatePrivateKey() const { |
| 9303 const String& url = String::Handle(this->url()); | 9307 const String& url = String::Handle(this->url()); |
| 9304 intptr_t key_value = url.Hash(); | 9308 intptr_t key_value = url.Hash(); |
| 9305 while (Library::IsKeyUsed(key_value)) { | 9309 while (Library::IsKeyUsed(key_value)) { |
| 9306 key_value++; | 9310 key_value++; |
| 9307 } | 9311 } |
| 9308 char private_key[32]; | 9312 char private_key[32]; |
| 9309 OS::SNPrint(private_key, sizeof(private_key), | 9313 OS::SNPrint(private_key, sizeof(private_key), |
| 9310 "%c%#" Px "", kPrivateKeySeparator, key_value); | 9314 "%c%" Pd "", kPrivateKeySeparator, key_value); |
| 9311 StorePointer(&raw_ptr()->private_key_, String::New(private_key, Heap::kOld)); | 9315 StorePointer(&raw_ptr()->private_key_, String::New(private_key, Heap::kOld)); |
| 9312 } | 9316 } |
| 9313 | 9317 |
| 9314 | 9318 |
| 9315 const String& Library::PrivateCoreLibName(const String& member) { | 9319 const String& Library::PrivateCoreLibName(const String& member) { |
| 9316 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 9320 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 9317 const String& private_name = String::ZoneHandle(core_lib.PrivateName(member)); | 9321 const String& private_name = String::ZoneHandle(core_lib.PrivateName(member)); |
| 9318 return private_name; | 9322 return private_name; |
| 9319 } | 9323 } |
| 9320 | 9324 |
| (...skipping 9687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19008 return tag_label.ToCString(); | 19012 return tag_label.ToCString(); |
| 19009 } | 19013 } |
| 19010 | 19014 |
| 19011 | 19015 |
| 19012 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19016 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 19013 Instance::PrintJSONImpl(stream, ref); | 19017 Instance::PrintJSONImpl(stream, ref); |
| 19014 } | 19018 } |
| 19015 | 19019 |
| 19016 | 19020 |
| 19017 } // namespace dart | 19021 } // namespace dart |
| OLD | NEW |