| Index: runtime/vm/object.h
|
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h
|
| index 840ec69d31f40c5d5951f8c9b0427be5bbe6ba60..6692c3f7d4a0b4ce820e2886208554f9256cb103 100644
|
| --- a/runtime/vm/object.h
|
| +++ b/runtime/vm/object.h
|
| @@ -8,6 +8,7 @@
|
| #include "include/dart_api.h"
|
| #include "platform/assert.h"
|
| #include "platform/utils.h"
|
| +#include "vm/json_stream.h"
|
| #include "vm/bitmap.h"
|
| #include "vm/dart.h"
|
| #include "vm/globals.h"
|
| @@ -119,6 +120,10 @@ class Symbols;
|
| return reinterpret_cast<Raw##object*>(Object::null()); \
|
| } \
|
| virtual const char* ToCString() const; \
|
| + /* Object is printed as JSON into stream. If ref is true only a header */ \
|
| + /* with an object id is printed. If ref is false the object is fully */ \
|
| + /* printed. */ \
|
| + virtual void PrintToJSONStream(JSONStream* stream, bool ref = true) const; \
|
| static const ClassId kClassId = k##object##Cid; \
|
| private: /* NOLINT */ \
|
| /* Initialize the handle based on the raw_ptr in the presence of null. */ \
|
| @@ -246,6 +251,19 @@ class Object {
|
| }
|
| }
|
|
|
| + 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();
|
| + }
|
| +
|
| // Returns the name that is used to identify an object in the
|
| // namespace dictionary.
|
| // Object::DictionaryName() returns String::null(). Only subclasses
|
|
|