Chromium Code Reviews| 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..c256044e1b5ea960e8be6800909176c8c74d533b 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[i] = elementConverter(new RequestDatum(request, "$path.$i", list[i])); |
|
scheglov
2014/06/15 18:08:15
Does it work?
Will it automatically increase the "
Brian Wilkerson
2014/06/16 15:05:16
No, it didn't work. If I'd remembered the tests fo
|
| + } |
| + return result; |
| + } |
| + |
| + /** |
| * Validate that the datum is a string, and return it. |
| */ |
| String asString() { |