| Index: runtime/vm/object.h
|
| ===================================================================
|
| --- runtime/vm/object.h (revision 27342)
|
| +++ runtime/vm/object.h (working copy)
|
| @@ -126,6 +126,9 @@
|
| /* with an object id is printed. If ref is false the object is fully */ \
|
| /* printed. */ \
|
| virtual void PrintToJSONStream(JSONStream* stream, bool ref = true) const; \
|
| + virtual const char* JSONType(bool ref) const { \
|
| + return ref ? "@"#object : ""#object; \
|
| + } \
|
| static const ClassId kClassId = k##object##Cid; \
|
| private: /* NOLINT */ \
|
| /* Initialize the handle based on the raw_ptr in the presence of null. */ \
|
| @@ -254,18 +257,14 @@
|
| }
|
|
|
| virtual void PrintToJSONStream(JSONStream* stream, bool ref = true) const {
|
| - if (IsNull()) {
|
| - stream->OpenObject();
|
| - stream->PrintProperty("type", "null");
|
| - stream->CloseObject();
|
| - return;
|
| - }
|
| - ASSERT(!IsNull());
|
| - stream->OpenObject();
|
| - stream->PrintProperty("type", "Object");
|
| - stream->CloseObject();
|
| + JSONObject jsobj(stream);
|
| + jsobj.AddProperty("type", JSONType(ref));
|
| }
|
|
|
| + virtual const char* JSONType(bool ref) const {
|
| + return IsNull() ? "null" : "Object";
|
| + }
|
| +
|
| // Returns the name that is used to identify an object in the
|
| // namespace dictionary.
|
| // Object::DictionaryName() returns String::null(). Only subclasses
|
|
|