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 10113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10124 const char* kFormat = "Library:'%s'"; | 10124 const char* kFormat = "Library:'%s'"; |
10125 const String& name = String::Handle(url()); | 10125 const String& name = String::Handle(url()); |
10126 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; | 10126 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; |
10127 char* chars = Thread::Current()->zone()->Alloc<char>(len); | 10127 char* chars = Thread::Current()->zone()->Alloc<char>(len); |
10128 OS::SNPrint(chars, len, kFormat, name.ToCString()); | 10128 OS::SNPrint(chars, len, kFormat, name.ToCString()); |
10129 return chars; | 10129 return chars; |
10130 } | 10130 } |
10131 | 10131 |
10132 | 10132 |
10133 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { | 10133 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { |
10134 const char* library_name = String::Handle(name()).ToCString(); | |
10135 intptr_t id = index(); | 10134 intptr_t id = index(); |
10136 ASSERT(id >= 0); | 10135 ASSERT(id >= 0); |
10137 JSONObject jsobj(stream); | 10136 JSONObject jsobj(stream); |
10138 AddCommonObjectProperties(&jsobj, "Library", ref); | 10137 AddCommonObjectProperties(&jsobj, "Library", ref); |
10139 jsobj.AddFixedServiceId("libraries/%" Pd "", id); | 10138 jsobj.AddFixedServiceId("libraries/%" Pd "", id); |
10140 jsobj.AddProperty("name", library_name); | 10139 const String& vm_name = String::Handle(name()); |
| 10140 const String& user_name = |
| 10141 String::Handle(String::IdentifierPrettyName(vm_name)); |
| 10142 AddNameProperties(&jsobj, user_name, vm_name); |
10141 const String& library_url = String::Handle(url()); | 10143 const String& library_url = String::Handle(url()); |
10142 jsobj.AddPropertyStr("uri", library_url); | 10144 jsobj.AddPropertyStr("uri", library_url); |
10143 if (ref) { | 10145 if (ref) { |
10144 return; | 10146 return; |
10145 } | 10147 } |
10146 jsobj.AddProperty("debuggable", IsDebuggable()); | 10148 jsobj.AddProperty("debuggable", IsDebuggable()); |
10147 { | 10149 { |
10148 JSONArray jsarr(&jsobj, "classes"); | 10150 JSONArray jsarr(&jsobj, "classes"); |
10149 ClassDictionaryIterator class_iter(*this); | 10151 ClassDictionaryIterator class_iter(*this); |
10150 Class& klass = Class::Handle(); | 10152 Class& klass = Class::Handle(); |
(...skipping 11215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21366 return tag_label.ToCString(); | 21368 return tag_label.ToCString(); |
21367 } | 21369 } |
21368 | 21370 |
21369 | 21371 |
21370 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21372 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21371 Instance::PrintJSONImpl(stream, ref); | 21373 Instance::PrintJSONImpl(stream, ref); |
21372 } | 21374 } |
21373 | 21375 |
21374 | 21376 |
21375 } // namespace dart | 21377 } // namespace dart |
OLD | NEW |