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

Unified Diff: pkg/analysis_server/lib/src/protocol.dart

Issue 483393002: Analysis server code generation improvements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « pkg/analysis_server/lib/src/generated_protocol.dart ('k') | pkg/analysis_server/lib/src/protocol2.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/protocol.dart
diff --git a/pkg/analysis_server/lib/src/protocol.dart b/pkg/analysis_server/lib/src/protocol.dart
index 29b89dcc58820075906e87dcc9d825dbf7d6b621..1ad195c7fb9d89c9e7d053054b26eac7cbb28e47 100644
--- a/pkg/analysis_server/lib/src/protocol.dart
+++ b/pkg/analysis_server/lib/src/protocol.dart
@@ -80,7 +80,7 @@ class Request {
/**
* A table mapping the names of request parameters to their values.
*/
- final Map<String, Object> params = new HashMap<String, Object>();
+ final Map<String, Object> params;
/**
* A decoder that can be used to decode strings into JSON objects.
@@ -89,9 +89,11 @@ class Request {
/**
* Initialize a newly created [Request] to have the given [id] and [method]
- * name.
+ * name. If [params] is supplied, it is used as the "params" map for the
+ * request. Otherwise an empty "params" map is allocated.
*/
- Request(this.id, this.method);
+ Request(this.id, this.method, [Map<String, Object> params])
+ : params = params != null ? params : new HashMap<String, Object>();
/**
* Return a request parsed from the given [data], or `null` if the [data] is
@@ -121,15 +123,11 @@ class Request {
return null;
}
var params = result[Request.PARAMS];
- Request request = new Request(id, method);
- if (params is Map) {
- params.forEach((String key, Object value) {
- request.setParameter(key, value);
- });
- } else if (params != null) {
+ if (params is Map || params == null) {
+ return new Request(id, method, params);
+ } else {
return null;
}
- return request;
} catch (exception) {
return null;
}
« no previous file with comments | « pkg/analysis_server/lib/src/generated_protocol.dart ('k') | pkg/analysis_server/lib/src/protocol2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698