Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1224)

Unified Diff: runtime/vm/object.cc

Issue 167713002: Improved how closures are displayed by <instance-ref>. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 9cd2f30fb2cf9f90c470dc5e330b1080543c7e13..df878d46bf24b22c675c544a76ca1be8610116ab 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12076,14 +12076,27 @@ void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const {
jsobj.AddProperty("type", ref ? "@Null" : "Null");
jsobj.AddProperty("id", "objects/being-initialized");
return;
+ } else if (raw() == Symbols::OptimizedOut().raw()) {
+ // TODO(turnidge): This is a hack. The user could have this
+ // special string in their program. Fixing this involves updating
+ // the debugging api a bit.
+ jsobj.AddProperty("type", ref ? "@Null" : "Null");
+ jsobj.AddProperty("id", "objects/optimized-out");
+ jsobj.AddProperty("preview", "<optimized out>");
+ return;
} else {
ObjectIdRing* ring = Isolate::Current()->object_id_ring();
intptr_t id = ring->GetIdForObject(raw());
- jsobj.AddProperty("type", JSONType(ref));
+ if (IsClosure()) {
+ const Function& closureFunc = Function::Handle(Closure::function(*this));
+ jsobj.AddProperty("closureFunc", closureFunc);
+ jsobj.AddProperty("type", ref ? "@Closure" : "Closure");
+ } else {
+ jsobj.AddProperty("type", JSONType(ref));
+ }
jsobj.AddPropertyF("id", "objects/%" Pd "", id);
jsobj.AddProperty("class", cls);
}
-
if (ref) {
return;
}
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/observatory_elements/observatory_element.dart ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698