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

Unified Diff: runtime/vm/service.cc

Issue 514833003: Add a new Sentinel type for sentinel responses. (They are not Null). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js, fix tests Created 6 years, 4 months 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service/protocol.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 0b6b443a4dc19abce6ddd04355a6e5d348f9f47b..515ab4e419feb4d7619b324a6c886321c95b01df 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1120,8 +1120,9 @@ static bool HandleInstanceCommands(Isolate* isolate,
return true;
}
const String& expr_str = String::Handle(isolate, String::New(expr));
- ASSERT(obj->IsInstance());
- const Instance& instance = Instance::Cast(*obj);
+ ASSERT(obj->IsInstance() || obj->IsNull());
+ Instance& instance = Instance::Handle();
+ instance ^= obj->raw();
const Object& result =
Object::Handle(instance.Evaluate(expr_str,
Array::empty_array(),
@@ -1672,11 +1673,11 @@ static bool HandleLibraries(Isolate* isolate, JSONStream* js) {
}
-static void PrintPseudoNull(JSONStream* js,
- const char* id,
- const char* preview) {
+static void PrintSentinel(JSONStream* js,
+ const char* id,
+ const char* preview) {
JSONObject jsobj(js);
- jsobj.AddProperty("type", "Null");
+ jsobj.AddProperty("type", "Sentinel");
jsobj.AddProperty("id", id);
jsobj.AddProperty("valueAsString", preview);
}
@@ -1864,7 +1865,7 @@ static bool HandleObjects(Isolate* isolate, JSONStream* js) {
PrintError(js, "expected at most 2 arguments but found %" Pd "\n",
js->num_arguments());
} else {
- PrintPseudoNull(js, "objects/collected", "<collected>");
+ PrintSentinel(js, "objects/collected", "<collected>");
}
return true;
@@ -1873,7 +1874,7 @@ static bool HandleObjects(Isolate* isolate, JSONStream* js) {
PrintError(js, "expected at most 2 arguments but found %" Pd "\n",
js->num_arguments());
} else {
- PrintPseudoNull(js, "objects/expired", "<expired>");
+ PrintSentinel(js, "objects/expired", "<expired>");
}
return true;
}
@@ -1890,11 +1891,11 @@ static bool HandleObjects(Isolate* isolate, JSONStream* js) {
// Print.
if (kind == ObjectIdRing::kCollected) {
// The object has been collected by the gc.
- PrintPseudoNull(js, "objects/collected", "<collected>");
+ PrintSentinel(js, "objects/collected", "<collected>");
return true;
} else if (kind == ObjectIdRing::kExpired) {
// The object id has expired.
- PrintPseudoNull(js, "objects/expired", "<expired>");
+ PrintSentinel(js, "objects/expired", "<expired>");
return true;
}
obj.PrintJSON(js, false);
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service/protocol.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698