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

Unified Diff: runtime/vm/service/message.dart

Issue 887413003: Port type arguments to new RPC protocol (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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/service.cc ('k') | runtime/vm/service/service.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service/message.dart
diff --git a/runtime/vm/service/message.dart b/runtime/vm/service/message.dart
index 86f57c1eebaab3474eb45617d2be7d9d3003246a..4b2f80a9bb4d7c0c954ef7ee08b7b349f295652e 100644
--- a/runtime/vm/service/message.dart
+++ b/runtime/vm/service/message.dart
@@ -62,6 +62,23 @@ class Message {
};
}
+ // Calls toString on all non-String elements of [list]. We do this so all
+ // elements in the list are strings, making consumption by C++ simpler.
+ // This has a side effect that boolean literal values like true become 'true'
+ // and thus indistinguishable from the string literal 'true'.
+ List _makeAllString(List list) {
+ if (list == null) {
+ return null;
+ }
+ for (var i = 0; i < list.length; i++) {
+ if (list[i] is String) {
+ continue;
+ }
+ list[i] = list[i].toString();
+ }
+ return list;
+ }
+
Future<String> send(SendPort sendPort) {
final receivePort = new RawReceivePort();
receivePort.handler = (value) {
@@ -72,8 +89,8 @@ class Message {
_completer.complete(value);
}
};
- var keys = params.keys.toList(growable:false);
- var values = params.values.toList(growable:false);
+ var keys = _makeAllString(params.keys.toList(growable:false));
+ var values = _makeAllString(params.values.toList(growable:false));
var request = new List(5)
..[0] = 0 // Make room for OOB message type.
..[1] = receivePort.sendPort
@@ -94,8 +111,8 @@ class Message {
_completer.complete(value);
}
};
- var keys = params.keys.toList(growable:false);
- var values = params.values.toList(growable:false);
+ var keys = _makeAllString(params.keys.toList(growable:false));
+ var values = _makeAllString(params.values.toList(growable:false));
var request = new List(5)
..[0] = 0 // Make room for OOB message type.
..[1] = receivePort.sendPort
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/service/service.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698