Index: runtime/vm/object_service.cc |
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc |
index 99e115733ff126ac74ed544e315fda25aeb03766..d4fc827ce49f6b8aafe568be9abe817517858b5f 100644 |
--- a/runtime/vm/object_service.cc |
+++ b/runtime/vm/object_service.cc |
@@ -243,6 +243,11 @@ void PatchClass::PrintJSONImpl(JSONStream* stream, bool ref) const { |
static void AddFunctionServiceId(const JSONObject& jsobj, |
const Function& f, |
const Class& cls) { |
+ if (cls.IsNull()) { |
+ ASSERT(f.IsSignatureFunction()); |
+ jsobj.AddServiceId(f); |
+ return; |
+ } |
// Special kinds of functions use indices in their respective lists. |
intptr_t id = -1; |
const char* selector = NULL; |
@@ -279,10 +284,13 @@ static void AddFunctionServiceId(const JSONObject& jsobj, |
void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { |
Class& cls = Class::Handle(Owner()); |
- ASSERT(!cls.IsNull()); |
- Error& err = Error::Handle(); |
- err ^= cls.EnsureIsFinalized(Thread::Current()); |
- ASSERT(err.IsNull()); |
+ if (!cls.IsNull()) { |
+ Error& err = Error::Handle(); |
+ err ^= cls.EnsureIsFinalized(Thread::Current()); |
+ ASSERT(err.IsNull()); |
+ } else { |
+ ASSERT(IsSignatureFunction()); |
+ } |
JSONObject jsobj(stream); |
AddCommonObjectProperties(&jsobj, "Function", ref); |
AddFunctionServiceId(jsobj, *this, cls); |
@@ -292,11 +300,13 @@ void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { |
const Function& parent = Function::Handle(parent_function()); |
if (!parent.IsNull()) { |
jsobj.AddProperty("owner", parent); |
- } else if (cls.IsTopLevel()) { |
- const Library& library = Library::Handle(cls.library()); |
- jsobj.AddProperty("owner", library); |
- } else { |
- jsobj.AddProperty("owner", cls); |
+ } else if (!cls.IsNull()) { |
+ if (cls.IsTopLevel()) { |
+ const Library& library = Library::Handle(cls.library()); |
+ jsobj.AddProperty("owner", library); |
+ } else { |
+ jsobj.AddProperty("owner", cls); |
+ } |
} |
const char* kind_string = Function::KindToCString(kind()); |
@@ -1099,6 +1109,7 @@ void AbstractType::PrintJSONImpl(JSONStream* stream, bool ref) const { |
void Type::PrintJSONImpl(JSONStream* stream, bool ref) const { |
+ // TODO(regis): Function types are not handled properly. |
JSONObject jsobj(stream); |
PrintSharedInstanceJSON(&jsobj, ref); |
jsobj.AddProperty("kind", "Type"); |