OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/debugger.h" | 5 #include "vm/debugger.h" |
6 #include "vm/disassembler.h" | 6 #include "vm/disassembler.h" |
7 #include "vm/object.h" | 7 #include "vm/object.h" |
8 #include "vm/object_store.h" | 8 #include "vm/object_store.h" |
9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
11 #include "vm/type_table.h" | 11 #include "vm/type_table.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 #ifndef PRODUCT | 15 #ifndef PRODUCT |
16 | 16 |
17 static void AddNameProperties(JSONObject* jsobj, | 17 static void AddNameProperties(JSONObject* jsobj, |
18 const String& name, | 18 const char* name, |
19 const String& vm_name) { | 19 const char* vm_name) { |
20 jsobj->AddProperty("name", name.ToCString()); | 20 jsobj->AddProperty("name", name); |
21 if (!name.Equals(vm_name)) { | 21 if (strcmp(name, vm_name) != 0) { |
22 jsobj->AddProperty("_vmName", vm_name.ToCString()); | 22 jsobj->AddProperty("_vmName", vm_name); |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 | 26 |
27 void Object::AddCommonObjectProperties(JSONObject* jsobj, | 27 void Object::AddCommonObjectProperties(JSONObject* jsobj, |
28 const char* protocol_type, | 28 const char* protocol_type, |
29 bool ref) const { | 29 bool ref) const { |
30 const char* vm_type = JSONType(); | 30 const char* vm_type = JSONType(); |
31 bool same_type = (strcmp(protocol_type, vm_type) == 0); | 31 bool same_type = (strcmp(protocol_type, vm_type) == 0); |
32 if (ref) { | 32 if (ref) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 JSONObject jsobj(stream); | 80 JSONObject jsobj(stream); |
81 if ((raw() == Class::null()) || (id() == kFreeListElement)) { | 81 if ((raw() == Class::null()) || (id() == kFreeListElement)) { |
82 // TODO(turnidge): This is weird and needs to be changed. | 82 // TODO(turnidge): This is weird and needs to be changed. |
83 jsobj.AddProperty("type", "null"); | 83 jsobj.AddProperty("type", "null"); |
84 return; | 84 return; |
85 } | 85 } |
86 AddCommonObjectProperties(&jsobj, "Class", ref); | 86 AddCommonObjectProperties(&jsobj, "Class", ref); |
87 jsobj.AddFixedServiceId("classes/%" Pd "", id()); | 87 jsobj.AddFixedServiceId("classes/%" Pd "", id()); |
88 const String& scrubbed_name = String::Handle(ScrubbedName()); | 88 const String& scrubbed_name = String::Handle(ScrubbedName()); |
89 const String& vm_name = String::Handle(Name()); | 89 const String& vm_name = String::Handle(Name()); |
90 AddNameProperties(&jsobj, scrubbed_name, vm_name); | 90 AddNameProperties(&jsobj, |
| 91 scrubbed_name.ToCString(), |
| 92 vm_name.ToCString()); |
91 if (ref) { | 93 if (ref) { |
92 return; | 94 return; |
93 } | 95 } |
94 | 96 |
95 const Error& err = Error::Handle(EnsureIsFinalized(Thread::Current())); | 97 const Error& err = Error::Handle(EnsureIsFinalized(Thread::Current())); |
96 if (!err.IsNull()) { | 98 if (!err.IsNull()) { |
97 jsobj.AddProperty("error", err); | 99 jsobj.AddProperty("error", err); |
98 } | 100 } |
99 jsobj.AddProperty("abstract", is_abstract()); | 101 jsobj.AddProperty("abstract", is_abstract()); |
100 jsobj.AddProperty("const", is_const()); | 102 jsobj.AddProperty("const", is_const()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 CanonicalTypeArgumentsSet typeargs_table( | 197 CanonicalTypeArgumentsSet typeargs_table( |
196 zone, object_store->canonical_type_arguments()); | 198 zone, object_store->canonical_type_arguments()); |
197 const Array& table = | 199 const Array& table = |
198 Array::Handle(HashTables::ToArray(typeargs_table, false)); | 200 Array::Handle(HashTables::ToArray(typeargs_table, false)); |
199 typeargs_table.Release(); | 201 typeargs_table.Release(); |
200 ASSERT(table.Length() > 0); | 202 ASSERT(table.Length() > 0); |
201 AddCommonObjectProperties(&jsobj, "TypeArguments", ref); | 203 AddCommonObjectProperties(&jsobj, "TypeArguments", ref); |
202 jsobj.AddServiceId(*this); | 204 jsobj.AddServiceId(*this); |
203 const String& user_name = String::Handle(UserVisibleName()); | 205 const String& user_name = String::Handle(UserVisibleName()); |
204 const String& vm_name = String::Handle(Name()); | 206 const String& vm_name = String::Handle(Name()); |
205 AddNameProperties(&jsobj, user_name, vm_name); | 207 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); |
206 if (ref) { | 208 if (ref) { |
207 return; | 209 return; |
208 } | 210 } |
209 { | 211 { |
210 JSONArray jsarr(&jsobj, "types"); | 212 JSONArray jsarr(&jsobj, "types"); |
211 AbstractType& type_arg = AbstractType::Handle(); | 213 AbstractType& type_arg = AbstractType::Handle(); |
212 for (intptr_t i = 0; i < Length(); i++) { | 214 for (intptr_t i = 0; i < Length(); i++) { |
213 type_arg = TypeAt(i); | 215 type_arg = TypeAt(i); |
214 jsarr.AddValue(type_arg); | 216 jsarr.AddValue(type_arg); |
215 } | 217 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 260 } |
259 if (id != -1) { | 261 if (id != -1) { |
260 ASSERT(selector != NULL); | 262 ASSERT(selector != NULL); |
261 jsobj.AddFixedServiceId("classes/%" Pd "/%s/%" Pd "", | 263 jsobj.AddFixedServiceId("classes/%" Pd "/%s/%" Pd "", |
262 cls.id(), selector, id); | 264 cls.id(), selector, id); |
263 return; | 265 return; |
264 } | 266 } |
265 // Regular functions known to their owner use their name (percent-encoded). | 267 // Regular functions known to their owner use their name (percent-encoded). |
266 String& name = String::Handle(f.name()); | 268 String& name = String::Handle(f.name()); |
267 if (cls.LookupFunction(name) == f.raw()) { | 269 if (cls.LookupFunction(name) == f.raw()) { |
268 name = String::EncodeIRI(name); | 270 const char* encoded_name = String::EncodeIRI(name); |
269 jsobj.AddFixedServiceId("classes/%" Pd "/functions/%s", | 271 jsobj.AddFixedServiceId("classes/%" Pd "/functions/%s", |
270 cls.id(), name.ToCString()); | 272 cls.id(), encoded_name); |
271 return; | 273 return; |
272 } | 274 } |
273 // Oddball functions (not known to their owner) fall back to use the object | 275 // Oddball functions (not known to their owner) fall back to use the object |
274 // id ring. Current known examples are signature functions of closures | 276 // id ring. Current known examples are signature functions of closures |
275 // and stubs like 'megamorphic_miss'. | 277 // and stubs like 'megamorphic_miss'. |
276 jsobj.AddServiceId(f); | 278 jsobj.AddServiceId(f); |
277 } | 279 } |
278 | 280 |
279 | 281 |
280 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { | 282 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { |
281 Class& cls = Class::Handle(Owner()); | 283 Class& cls = Class::Handle(Owner()); |
282 ASSERT(!cls.IsNull()); | 284 ASSERT(!cls.IsNull()); |
283 Error& err = Error::Handle(); | 285 Error& err = Error::Handle(); |
284 err ^= cls.EnsureIsFinalized(Thread::Current()); | 286 err ^= cls.EnsureIsFinalized(Thread::Current()); |
285 ASSERT(err.IsNull()); | 287 ASSERT(err.IsNull()); |
286 JSONObject jsobj(stream); | 288 JSONObject jsobj(stream); |
287 AddCommonObjectProperties(&jsobj, "Function", ref); | 289 AddCommonObjectProperties(&jsobj, "Function", ref); |
288 AddFunctionServiceId(jsobj, *this, cls); | 290 AddFunctionServiceId(jsobj, *this, cls); |
289 const String& user_name = String::Handle(UserVisibleName()); | 291 const String& user_name = String::Handle(UserVisibleName()); |
290 const String& vm_name = String::Handle(name()); | 292 const String& vm_name = String::Handle(name()); |
291 AddNameProperties(&jsobj, user_name, vm_name); | 293 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); |
292 const Function& parent = Function::Handle(parent_function()); | 294 const Function& parent = Function::Handle(parent_function()); |
293 if (!parent.IsNull()) { | 295 if (!parent.IsNull()) { |
294 jsobj.AddProperty("owner", parent); | 296 jsobj.AddProperty("owner", parent); |
295 } else if (cls.IsTopLevel()) { | 297 } else if (cls.IsTopLevel()) { |
296 const Library& library = Library::Handle(cls.library()); | 298 const Library& library = Library::Handle(cls.library()); |
297 jsobj.AddProperty("owner", library); | 299 jsobj.AddProperty("owner", library); |
298 } else { | 300 } else { |
299 jsobj.AddProperty("owner", cls); | 301 jsobj.AddProperty("owner", cls); |
300 } | 302 } |
301 | 303 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 347 |
346 void RedirectionData::PrintJSONImpl(JSONStream* stream, bool ref) const { | 348 void RedirectionData::PrintJSONImpl(JSONStream* stream, bool ref) const { |
347 Object::PrintJSONImpl(stream, ref); | 349 Object::PrintJSONImpl(stream, ref); |
348 } | 350 } |
349 | 351 |
350 | 352 |
351 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { | 353 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { |
352 JSONObject jsobj(stream); | 354 JSONObject jsobj(stream); |
353 Class& cls = Class::Handle(Owner()); | 355 Class& cls = Class::Handle(Owner()); |
354 String& field_name = String::Handle(name()); | 356 String& field_name = String::Handle(name()); |
355 field_name = String::EncodeIRI(field_name); | 357 const char* encoded_field_name = String::EncodeIRI(field_name); |
356 AddCommonObjectProperties(&jsobj, "Field", ref); | 358 AddCommonObjectProperties(&jsobj, "Field", ref); |
357 jsobj.AddFixedServiceId("classes/%" Pd "/fields/%s", | 359 jsobj.AddFixedServiceId("classes/%" Pd "/fields/%s", |
358 cls.id(), field_name.ToCString()); | 360 cls.id(), encoded_field_name); |
359 | 361 |
360 const String& user_name = String::Handle(UserVisibleName()); | 362 const String& user_name = String::Handle(UserVisibleName()); |
361 const String& vm_name = String::Handle(name()); | 363 const String& vm_name = String::Handle(name()); |
362 AddNameProperties(&jsobj, user_name, vm_name); | 364 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); |
363 if (cls.IsTopLevel()) { | 365 if (cls.IsTopLevel()) { |
364 const Library& library = Library::Handle(cls.library()); | 366 const Library& library = Library::Handle(cls.library()); |
365 jsobj.AddProperty("owner", library); | 367 jsobj.AddProperty("owner", library); |
366 } else { | 368 } else { |
367 jsobj.AddProperty("owner", cls); | 369 jsobj.AddProperty("owner", cls); |
368 } | 370 } |
369 | 371 |
370 AbstractType& declared_type = AbstractType::Handle(type()); | 372 AbstractType& declared_type = AbstractType::Handle(type()); |
371 jsobj.AddProperty("declaredType", declared_type); | 373 jsobj.AddProperty("declaredType", declared_type); |
372 jsobj.AddProperty("static", is_static()); | 374 jsobj.AddProperty("static", is_static()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 JSONArray members(&jsobj, "members"); | 429 JSONArray members(&jsobj, "members"); |
428 } | 430 } |
429 | 431 |
430 | 432 |
431 // See also Dart_ScriptGetTokenInfo. | 433 // See also Dart_ScriptGetTokenInfo. |
432 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { | 434 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { |
433 JSONObject jsobj(stream); | 435 JSONObject jsobj(stream); |
434 AddCommonObjectProperties(&jsobj, "Script", ref); | 436 AddCommonObjectProperties(&jsobj, "Script", ref); |
435 const String& uri = String::Handle(url()); | 437 const String& uri = String::Handle(url()); |
436 ASSERT(!uri.IsNull()); | 438 ASSERT(!uri.IsNull()); |
437 const String& encoded_uri = String::Handle(String::EncodeIRI(uri)); | 439 const char* encoded_uri = String::EncodeIRI(uri); |
438 ASSERT(!encoded_uri.IsNull()); | |
439 const Library& lib = Library::Handle(FindLibrary()); | 440 const Library& lib = Library::Handle(FindLibrary()); |
440 if (lib.IsNull()) { | 441 if (lib.IsNull()) { |
441 jsobj.AddServiceId(*this); | 442 jsobj.AddServiceId(*this); |
442 } else { | 443 } else { |
443 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s/%" Px64 "", | 444 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s/%" Px64 "", |
444 lib.index(), encoded_uri.ToCString(), | 445 lib.index(), encoded_uri, |
445 load_timestamp()); | 446 load_timestamp()); |
446 } | 447 } |
447 jsobj.AddPropertyStr("uri", uri); | 448 jsobj.AddPropertyStr("uri", uri); |
448 jsobj.AddProperty("_kind", GetKindAsCString()); | 449 jsobj.AddProperty("_kind", GetKindAsCString()); |
449 if (ref) { | 450 if (ref) { |
450 return; | 451 return; |
451 } | 452 } |
452 jsobj.AddPropertyTimeMillis("_loadTime", load_timestamp()); | 453 jsobj.AddPropertyTimeMillis("_loadTime", load_timestamp()); |
453 if (!lib.IsNull()) { | 454 if (!lib.IsNull()) { |
454 jsobj.AddProperty("library", lib); | 455 jsobj.AddProperty("library", lib); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 493 |
493 | 494 |
494 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { | 495 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { |
495 intptr_t id = index(); | 496 intptr_t id = index(); |
496 ASSERT(id >= 0); | 497 ASSERT(id >= 0); |
497 JSONObject jsobj(stream); | 498 JSONObject jsobj(stream); |
498 AddCommonObjectProperties(&jsobj, "Library", ref); | 499 AddCommonObjectProperties(&jsobj, "Library", ref); |
499 jsobj.AddFixedServiceId("libraries/%" Pd "", id); | 500 jsobj.AddFixedServiceId("libraries/%" Pd "", id); |
500 const String& vm_name = String::Handle(name()); | 501 const String& vm_name = String::Handle(name()); |
501 const String& scrubbed_name = String::Handle(String::ScrubName(vm_name)); | 502 const String& scrubbed_name = String::Handle(String::ScrubName(vm_name)); |
502 AddNameProperties(&jsobj, scrubbed_name, vm_name); | 503 AddNameProperties(&jsobj, scrubbed_name.ToCString(), vm_name.ToCString()); |
503 const String& library_url = String::Handle(url()); | 504 const String& library_url = String::Handle(url()); |
504 jsobj.AddPropertyStr("uri", library_url); | 505 jsobj.AddPropertyStr("uri", library_url); |
505 if (ref) { | 506 if (ref) { |
506 return; | 507 return; |
507 } | 508 } |
508 jsobj.AddProperty("debuggable", IsDebuggable()); | 509 jsobj.AddProperty("debuggable", IsDebuggable()); |
509 { | 510 { |
510 JSONArray jsarr(&jsobj, "classes"); | 511 JSONArray jsarr(&jsobj, "classes"); |
511 ClassDictionaryIterator class_iter(*this); | 512 ClassDictionaryIterator class_iter(*this); |
512 Class& klass = Class::Handle(); | 513 Class& klass = Class::Handle(); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 } | 802 } |
802 } | 803 } |
803 | 804 |
804 | 805 |
805 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { | 806 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { |
806 JSONObject jsobj(stream); | 807 JSONObject jsobj(stream); |
807 AddCommonObjectProperties(&jsobj, "Code", ref); | 808 AddCommonObjectProperties(&jsobj, "Code", ref); |
808 jsobj.AddFixedServiceId("code/%" Px64"-%" Px "", | 809 jsobj.AddFixedServiceId("code/%" Px64"-%" Px "", |
809 compile_timestamp(), | 810 compile_timestamp(), |
810 PayloadStart()); | 811 PayloadStart()); |
811 const String& qualified_name = String::Handle(QualifiedName()); | 812 const char* qualified_name = QualifiedName(); |
812 const String& vm_name = String::Handle(Name()); | 813 const char* vm_name = Name(); |
813 AddNameProperties(&jsobj, qualified_name, vm_name); | 814 AddNameProperties(&jsobj, qualified_name, vm_name); |
814 const bool is_stub = IsStubCode() || IsAllocationStubCode(); | 815 const bool is_stub = IsStubCode() || IsAllocationStubCode(); |
815 if (is_stub) { | 816 if (is_stub) { |
816 jsobj.AddProperty("kind", "Stub"); | 817 jsobj.AddProperty("kind", "Stub"); |
817 } else { | 818 } else { |
818 jsobj.AddProperty("kind", "Dart"); | 819 jsobj.AddProperty("kind", "Dart"); |
819 } | 820 } |
820 jsobj.AddProperty("_optimized", is_optimized()); | 821 jsobj.AddProperty("_optimized", is_optimized()); |
821 const Object& obj = Object::Handle(owner()); | 822 const Object& obj = Object::Handle(owner()); |
822 if (obj.IsFunction()) { | 823 if (obj.IsFunction()) { |
823 const Function& func = Function::Cast(obj); | 824 const Function& func = Function::Cast(obj); |
824 jsobj.AddProperty("_intrinsic", func.is_intrinsic()); | 825 jsobj.AddProperty("_intrinsic", func.is_intrinsic()); |
825 jsobj.AddProperty("_native", func.is_native()); | 826 jsobj.AddProperty("_native", func.is_native()); |
826 } else { | 827 } else { |
827 jsobj.AddProperty("_intrinsic", false); | 828 jsobj.AddProperty("_intrinsic", false); |
828 jsobj.AddProperty("_native", false); | 829 jsobj.AddProperty("_native", false); |
829 } | 830 } |
830 if (ref) { | 831 if (ref) { |
831 return; | 832 return; |
832 } | 833 } |
833 if (obj.IsFunction()) { | 834 if (obj.IsFunction()) { |
834 jsobj.AddProperty("function", obj); | 835 jsobj.AddProperty("function", obj); |
835 } else { | 836 } else { |
836 // Generate a fake function reference. | 837 // Generate a fake function reference. |
837 JSONObject func(&jsobj, "function"); | 838 JSONObject func(&jsobj, "function"); |
838 func.AddProperty("type", "@Function"); | 839 func.AddProperty("type", "@Function"); |
839 func.AddProperty("_kind", "Stub"); | 840 func.AddProperty("_kind", "Stub"); |
840 ASSERT(qualified_name.Equals(vm_name)); | 841 ASSERT(strcmp(qualified_name, vm_name) == 0); |
841 func.AddProperty("name", vm_name.ToCString()); | 842 func.AddProperty("name", vm_name); |
842 AddNameProperties(&func, vm_name, vm_name); | 843 AddNameProperties(&func, vm_name, vm_name); |
843 } | 844 } |
844 jsobj.AddPropertyF("_startAddress", "%" Px "", PayloadStart()); | 845 jsobj.AddPropertyF("_startAddress", "%" Px "", PayloadStart()); |
845 jsobj.AddPropertyF("_endAddress", "%" Px "", PayloadStart() + Size()); | 846 jsobj.AddPropertyF("_endAddress", "%" Px "", PayloadStart() + Size()); |
846 jsobj.AddProperty("_alive", is_alive()); | 847 jsobj.AddProperty("_alive", is_alive()); |
847 const ObjectPool& object_pool = ObjectPool::Handle(GetObjectPool()); | 848 const ObjectPool& object_pool = ObjectPool::Handle(GetObjectPool()); |
848 jsobj.AddProperty("_objectPool", object_pool); | 849 jsobj.AddProperty("_objectPool", object_pool); |
849 { | 850 { |
850 JSONArray jsarr(&jsobj, "_disassembly"); | 851 JSONArray jsarr(&jsobj, "_disassembly"); |
851 if (is_alive()) { | 852 if (is_alive()) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 jsobj.AddFixedServiceId("classes/%" Pd "/types/%d", cid, 0); | 1116 jsobj.AddFixedServiceId("classes/%" Pd "/types/%d", cid, 0); |
1116 } else { | 1117 } else { |
1117 jsobj.AddServiceId(*this); | 1118 jsobj.AddServiceId(*this); |
1118 } | 1119 } |
1119 jsobj.AddProperty("typeClass", type_cls); | 1120 jsobj.AddProperty("typeClass", type_cls); |
1120 } else { | 1121 } else { |
1121 jsobj.AddServiceId(*this); | 1122 jsobj.AddServiceId(*this); |
1122 } | 1123 } |
1123 const String& user_name = String::Handle(UserVisibleName()); | 1124 const String& user_name = String::Handle(UserVisibleName()); |
1124 const String& vm_name = String::Handle(Name()); | 1125 const String& vm_name = String::Handle(Name()); |
1125 AddNameProperties(&jsobj, user_name, vm_name); | 1126 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); |
1126 if (ref) { | 1127 if (ref) { |
1127 return; | 1128 return; |
1128 } | 1129 } |
1129 const TypeArguments& typeArgs = TypeArguments::Handle(arguments()); | 1130 const TypeArguments& typeArgs = TypeArguments::Handle(arguments()); |
1130 if (!typeArgs.IsNull()) { | 1131 if (!typeArgs.IsNull()) { |
1131 jsobj.AddProperty("typeArguments", typeArgs); | 1132 jsobj.AddProperty("typeArguments", typeArgs); |
1132 } | 1133 } |
1133 } | 1134 } |
1134 | 1135 |
1135 | 1136 |
1136 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1137 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { |
1137 JSONObject jsobj(stream); | 1138 JSONObject jsobj(stream); |
1138 PrintSharedInstanceJSON(&jsobj, ref); | 1139 PrintSharedInstanceJSON(&jsobj, ref); |
1139 jsobj.AddProperty("kind", "TypeRef"); | 1140 jsobj.AddProperty("kind", "TypeRef"); |
1140 jsobj.AddServiceId(*this); | 1141 jsobj.AddServiceId(*this); |
1141 const String& user_name = String::Handle(UserVisibleName()); | 1142 const String& user_name = String::Handle(UserVisibleName()); |
1142 const String& vm_name = String::Handle(Name()); | 1143 const String& vm_name = String::Handle(Name()); |
1143 AddNameProperties(&jsobj, user_name, vm_name); | 1144 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); |
1144 if (ref) { | 1145 if (ref) { |
1145 return; | 1146 return; |
1146 } | 1147 } |
1147 jsobj.AddProperty("targetType", AbstractType::Handle(type())); | 1148 jsobj.AddProperty("targetType", AbstractType::Handle(type())); |
1148 } | 1149 } |
1149 | 1150 |
1150 | 1151 |
1151 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1152 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { |
1152 JSONObject jsobj(stream); | 1153 JSONObject jsobj(stream); |
1153 PrintSharedInstanceJSON(&jsobj, ref); | 1154 PrintSharedInstanceJSON(&jsobj, ref); |
1154 jsobj.AddProperty("kind", "TypeParameter"); | 1155 jsobj.AddProperty("kind", "TypeParameter"); |
1155 jsobj.AddServiceId(*this); | 1156 jsobj.AddServiceId(*this); |
1156 const String& user_name = String::Handle(UserVisibleName()); | 1157 const String& user_name = String::Handle(UserVisibleName()); |
1157 const String& vm_name = String::Handle(Name()); | 1158 const String& vm_name = String::Handle(Name()); |
1158 AddNameProperties(&jsobj, user_name, vm_name); | 1159 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); |
1159 const Class& param_cls = Class::Handle(parameterized_class()); | 1160 const Class& param_cls = Class::Handle(parameterized_class()); |
1160 jsobj.AddProperty("parameterizedClass", param_cls); | 1161 jsobj.AddProperty("parameterizedClass", param_cls); |
1161 if (ref) { | 1162 if (ref) { |
1162 return; | 1163 return; |
1163 } | 1164 } |
1164 jsobj.AddProperty("parameterIndex", index()); | 1165 jsobj.AddProperty("parameterIndex", index()); |
1165 const AbstractType& upper_bound = AbstractType::Handle(bound()); | 1166 const AbstractType& upper_bound = AbstractType::Handle(bound()); |
1166 jsobj.AddProperty("bound", upper_bound); | 1167 jsobj.AddProperty("bound", upper_bound); |
1167 } | 1168 } |
1168 | 1169 |
1169 | 1170 |
1170 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1171 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { |
1171 JSONObject jsobj(stream); | 1172 JSONObject jsobj(stream); |
1172 PrintSharedInstanceJSON(&jsobj, ref); | 1173 PrintSharedInstanceJSON(&jsobj, ref); |
1173 jsobj.AddProperty("kind", "BoundedType"); | 1174 jsobj.AddProperty("kind", "BoundedType"); |
1174 jsobj.AddServiceId(*this); | 1175 jsobj.AddServiceId(*this); |
1175 const String& user_name = String::Handle(UserVisibleName()); | 1176 const String& user_name = String::Handle(UserVisibleName()); |
1176 const String& vm_name = String::Handle(Name()); | 1177 const String& vm_name = String::Handle(Name()); |
1177 AddNameProperties(&jsobj, user_name, vm_name); | 1178 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); |
1178 if (ref) { | 1179 if (ref) { |
1179 return; | 1180 return; |
1180 } | 1181 } |
1181 jsobj.AddProperty("targetType", AbstractType::Handle(type())); | 1182 jsobj.AddProperty("targetType", AbstractType::Handle(type())); |
1182 jsobj.AddProperty("bound", AbstractType::Handle(bound())); | 1183 jsobj.AddProperty("bound", AbstractType::Handle(bound())); |
1183 } | 1184 } |
1184 | 1185 |
1185 | 1186 |
1186 void MixinAppType::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1187 void MixinAppType::PrintJSONImpl(JSONStream* stream, bool ref) const { |
1187 UNREACHABLE(); | 1188 UNREACHABLE(); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 jsobj.AddProperty("mirrorReferent", referent_handle); | 1571 jsobj.AddProperty("mirrorReferent", referent_handle); |
1571 } | 1572 } |
1572 | 1573 |
1573 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1574 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
1574 Instance::PrintJSONImpl(stream, ref); | 1575 Instance::PrintJSONImpl(stream, ref); |
1575 } | 1576 } |
1576 | 1577 |
1577 #endif | 1578 #endif |
1578 | 1579 |
1579 } // namespace dart | 1580 } // namespace dart |
OLD | NEW |