Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: runtime/vm/object_service.cc

Issue 2606993002: Second try: Fix resolution and canonicalization of typedefs and function types (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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");

Powered by Google App Engine
This is Rietveld 408576698