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

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

Issue 337943002: Adjust server for API changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed bug Created 6 years, 6 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
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 85a762de026ce9d05552e8017357754a8d9e83a9..785a54f71e0da58e2f18d0aee0dc436f35cb3c68 100644
--- a/pkg/analysis_server/lib/src/protocol.dart
+++ b/pkg/analysis_server/lib/src/protocol.dart
@@ -286,6 +286,23 @@ class RequestDatum {
}
/**
+ * Validate that the datum is a list, and return a list where each element in
+ * the datum has been converted using the provided function.
+ */
+ List asList(elementConverter(RequestDatum datum)) {
+ if (datum is! List) {
+ throw new RequestFailure(new Response.invalidParameter(request, path,
+ "be a list"));
+ }
+ List list = datum as List;
+ List result = [];
+ for (int i = 0; i < list.length; i++) {
+ result.add(elementConverter(new RequestDatum(request, "$path.$i", list[i])));
+ }
+ return result;
+ }
+
+ /**
* Validate that the datum is a string, and return it.
*/
String asString() {
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation_analysis.dart ('k') | pkg/analysis_server/lib/src/socket_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698