Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 7ef217f7d371582f067a26eccf732fd3e819bd84..c1b5425fca4c71b021b5eded46c2eb75797cdcbc 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -12441,7 +12441,33 @@ void Context::Dump(int indent) const { |
| void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| - Object::PrintJSONImpl(stream, ref); |
| + JSONObject jsobj(stream); |
| + jsobj.AddProperty("type", JSONType(ref)); |
| + ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| + const intptr_t id = ring->GetIdForObject(raw()); |
| + jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| + |
| + jsobj.AddProperty("length", num_variables()); |
| + |
| + if (ref) { |
| + return; |
| + } |
| + |
| + Class& cls = Class::Handle(this->clazz()); |
| + jsobj.AddProperty("class", cls); |
| + |
| + jsobj.AddProperty("size", raw()->Size()); |
| + |
| + const Context& parent_context = Context::Handle(parent()); |
| + jsobj.AddProperty("parent", parent_context); |
| + |
| + JSONArray jsarr(&jsobj, "elements"); |
|
Cutch
2014/09/03 22:06:49
Why not "variables" instead of "elements"?
rmacnak
2014/09/03 22:44:06
Fixed.
|
| + for (intptr_t i = 0; i < num_variables(); i++) { |
| + const Instance& var = Instance::Handle(At(i)); |
| + JSONObject jselement(&jsarr); |
| + jselement.AddProperty("index", i); |
| + jselement.AddProperty("value", var); |
| + } |
| } |
| @@ -13619,6 +13645,8 @@ void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| if (IsClosure()) { |
| const Function& closureFunc = Function::Handle(Closure::function(*this)); |
| jsobj.AddProperty("closureFunc", closureFunc); |
| + const Context& closureCtxt = Context::Handle(Closure::context(*this)); |
| + jsobj.AddProperty("closureCtxt", closureCtxt); |
| } |
| jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| if (ref) { |