| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index 800fad3b3e2ee4b638f7fb5b8d450fa8a7986a86..7bcbddd66a002e2e768f51d021717f8cfcc28b1c 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -1593,14 +1593,11 @@ static void AddTypeProperties(JSONObject* jsobj,
|
| bool same_type = (strcmp(user_type, vm_type) == 0);
|
| if (ref) {
|
| jsobj->AddPropertyF("type", "@%s", user_type);
|
| - if (!same_type) {
|
| - jsobj->AddPropertyF("_vmType", "@%s", vm_type);
|
| - }
|
| } else {
|
| jsobj->AddProperty("type", user_type);
|
| - if (!same_type) {
|
| - jsobj->AddProperty("_vmType", vm_type);
|
| - }
|
| + }
|
| + if (!same_type) {
|
| + jsobj->AddProperty("_vmType", vm_type);
|
| }
|
| }
|
|
|
| @@ -1608,7 +1605,8 @@ static void AddTypeProperties(JSONObject* jsobj,
|
| void Object::PrintJSON(JSONStream* stream, bool ref) const {
|
| if (IsNull()) {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "null", JSONType(), ref);
|
| + AddTypeProperties(&jsobj, "Instance", JSONType(), ref);
|
| + jsobj.AddProperty("kind", "Null");
|
| jsobj.AddFixedServiceId("objects/null");
|
| jsobj.AddProperty("valueAsString", "null");
|
| if (!ref) {
|
| @@ -14148,6 +14146,7 @@ const char* Instance::ToCString() const {
|
|
|
| void Instance::PrintSharedInstanceJSON(JSONObject* jsobj,
|
| bool ref) const {
|
| + AddTypeProperties(jsobj, "Instance", JSONType(), ref);
|
| Class& cls = Class::Handle(this->clazz());
|
| jsobj->AddProperty("class", cls);
|
| // TODO(turnidge): Provide the type arguments here too.
|
| @@ -14211,12 +14210,18 @@ void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| return;
|
| }
|
|
|
| - AddTypeProperties(&jsobj, "Instance", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + if (IsClosure()) {
|
| + jsobj.AddProperty("kind", "Closure");
|
| + } else {
|
| + jsobj.AddProperty("kind", "PlainInstance");
|
| + }
|
| jsobj.AddServiceId(*this);
|
| if (IsClosure()) {
|
| - jsobj.AddProperty("function", Function::Handle(Closure::function(*this)));
|
| - jsobj.AddProperty("context", Context::Handle(Closure::context(*this)));
|
| + jsobj.AddProperty("closureFunction",
|
| + Function::Handle(Closure::function(*this)));
|
| + jsobj.AddProperty("closureContext",
|
| + Context::Handle(Closure::context(*this)));
|
| }
|
| if (ref) {
|
| return;
|
| @@ -15309,8 +15314,8 @@ const char* Type::ToCString() const {
|
|
|
| void Type::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "Type", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "Type");
|
| if (IsCanonical()) {
|
| const Class& type_cls = Class::Handle(type_class());
|
| intptr_t id = type_cls.FindCanonicalTypeIndex(*this);
|
| @@ -15500,8 +15505,8 @@ const char* TypeRef::ToCString() const {
|
|
|
| void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "TypeRef", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "TypeRef");
|
| jsobj.AddServiceId(*this);
|
| const String& user_name = String::Handle(PrettyName());
|
| const String& vm_name = String::Handle(Name());
|
| @@ -15734,8 +15739,8 @@ const char* TypeParameter::ToCString() const {
|
|
|
| void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "TypeParameter", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "TypeParameter");
|
| jsobj.AddServiceId(*this);
|
| const String& user_name = String::Handle(PrettyName());
|
| const String& vm_name = String::Handle(Name());
|
| @@ -15745,7 +15750,7 @@ void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| if (ref) {
|
| return;
|
| }
|
| - jsobj.AddProperty("index", index());
|
| + jsobj.AddProperty("parameterIndex", index());
|
| const AbstractType& upper_bound = AbstractType::Handle(bound());
|
| jsobj.AddProperty("upperBound", upper_bound);
|
| }
|
| @@ -15950,8 +15955,8 @@ const char* BoundedType::ToCString() const {
|
|
|
| void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "BoundedType", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "BoundedType");
|
| jsobj.AddServiceId(*this);
|
| const String& user_name = String::Handle(PrettyName());
|
| const String& vm_name = String::Handle(Name());
|
| @@ -16053,8 +16058,8 @@ const char* Integer::ToCString() const {
|
|
|
| void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "int", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "Int");
|
| jsobj.AddServiceId(*this);
|
| jsobj.AddProperty("valueAsString", ToCString());
|
| }
|
| @@ -16482,8 +16487,8 @@ const char* Smi::ToCString() const {
|
|
|
| void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "int", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "Int");
|
| jsobj.AddFixedServiceId("objects/int-%" Pd "", Value());
|
| jsobj.AddPropertyF("valueAsString", "%" Pd "", Value());
|
| }
|
| @@ -16744,10 +16749,8 @@ const char* Double::ToCString() const {
|
|
|
| void Double::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - // Suppress the fact that the internal vm name for this type is
|
| - // "Double". Return "double" instead.
|
| - AddTypeProperties(&jsobj, "double", "double", ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "Double");
|
| jsobj.AddServiceId(*this);
|
| jsobj.AddProperty("valueAsString", ToCString());
|
| }
|
| @@ -18326,8 +18329,8 @@ void String::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| jsobj.AddProperty("valueAsString", "<optimized out>");
|
| return;
|
| }
|
| - AddTypeProperties(&jsobj, "String", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "String");
|
| jsobj.AddServiceId(*this);
|
| if (ref) {
|
| bool did_truncate = jsobj.AddPropertyStr("valueAsString", *this, 128);
|
| @@ -19235,10 +19238,8 @@ const char* Bool::ToCString() const {
|
| void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| const char* str = ToCString();
|
| JSONObject jsobj(stream);
|
| - // Suppress the fact that the internal vm name for this type is
|
| - // "Bool". Return "bool" instead.
|
| - AddTypeProperties(&jsobj, "bool", "bool", ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "Bool");
|
| jsobj.AddFixedServiceId("objects/bool-%s", str);
|
| jsobj.AddPropertyF("valueAsString", "%s", str);
|
| }
|
| @@ -19349,8 +19350,8 @@ const char* Array::ToCString() const {
|
|
|
| void Array::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "List", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "List");
|
| jsobj.AddServiceId(*this);
|
| jsobj.AddProperty("length", Length());
|
| if (ref) {
|
| @@ -19595,8 +19596,8 @@ const char* GrowableObjectArray::ToCString() const {
|
| void GrowableObjectArray::PrintJSONImpl(JSONStream* stream,
|
| bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "List", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "List");
|
| jsobj.AddServiceId(*this);
|
| jsobj.AddProperty("length", Length());
|
| if (ref) {
|
| @@ -19707,8 +19708,15 @@ const char* LinkedHashMap::ToCString() const {
|
|
|
|
|
| void LinkedHashMap::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| + JSONObject jsobj(stream);
|
| + PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "Map");
|
| + jsobj.AddServiceId(*this);
|
| + // TODO(koda): Print length.
|
| + if (ref) {
|
| + return;
|
| + }
|
| // TODO(koda): Print key/value pairs.
|
| - Instance::PrintJSONImpl(stream, ref);
|
| }
|
|
|
|
|
| @@ -20583,17 +20591,17 @@ const char* WeakProperty::ToCString() const {
|
|
|
| void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "Instance", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "WeakProperty");
|
| jsobj.AddServiceId(*this);
|
| if (ref) {
|
| return;
|
| }
|
|
|
| const Object& key_handle = Object::Handle(key());
|
| - jsobj.AddProperty("key", key_handle);
|
| + jsobj.AddProperty("propertyKey", key_handle);
|
| const Object& value_handle = Object::Handle(value());
|
| - jsobj.AddProperty("value", value_handle);
|
| + jsobj.AddProperty("propertyValue", value_handle);
|
| }
|
|
|
| RawAbstractType* MirrorReference::GetAbstractTypeReferent() const {
|
| @@ -20654,8 +20662,8 @@ const char* MirrorReference::ToCString() const {
|
|
|
| void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - AddTypeProperties(&jsobj, "Instance", JSONType(), ref);
|
| PrintSharedInstanceJSON(&jsobj, ref);
|
| + jsobj.AddProperty("kind", "MirrorReference");
|
| jsobj.AddServiceId(*this);
|
|
|
| if (ref) {
|
| @@ -20663,7 +20671,7 @@ void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const {
|
| }
|
|
|
| const Object& referent_handle = Object::Handle(referent());
|
| - jsobj.AddProperty("referent", referent_handle);
|
| + jsobj.AddProperty("mirrorReferent", referent_handle);
|
| }
|
|
|
|
|
|
|