Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 8ba182a30b55d34f06cab4fbc87dfe6df5d1c068..623783f2b9fb28b7442ed5e4999aa032e94fdfbd 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -7043,6 +7043,17 @@ const char* Script::ToCString() const { |
void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { |
JSONObject jsobj(stream); |
+ ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
+ intptr_t id = ring->GetIdForObject(raw()); |
+ jsobj.AddProperty("type", JSONType(ref)); |
+ jsobj.AddProperty("id", id); |
+ const String& name = String::Handle(url()); |
+ jsobj.AddProperty("name", name.ToCString()); |
+ if (ref) { |
+ return; |
+ } |
+ const String& source = String::Handle(Source()); |
+ jsobj.AddProperty("source", source.ToCString()); |
} |
@@ -8130,6 +8141,15 @@ void Library::PrintToJSONStream(JSONStream* stream, bool ref) const { |
jsarr.AddValue(lib); |
} |
} |
+ { |
+ JSONArray jsarr(&jsobj, "scripts"); |
+ Array& scripts = Array::Handle(LoadedScripts()); |
+ Script& script = Script::Handle(); |
+ for (intptr_t i = 0; i < scripts.Length(); i++) { |
+ script ^= scripts.At(i); |
+ jsarr.AddValue(script); |
+ } |
+ } |
} |