| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library protocol; | 5 library protocol; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert' show JsonDecoder; | 8 import 'dart:convert' show JsonDecoder; |
| 9 | 9 |
| 10 import 'package:analysis_services/json.dart'; | 10 import 'package:analysis_services/json.dart'; |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 455 } |
| 456 | 456 |
| 457 bool get isNull => datum == null; | 457 bool get isNull => datum == null; |
| 458 } | 458 } |
| 459 | 459 |
| 460 /** | 460 /** |
| 461 * Instances of the class [Response] represent a response to a request. | 461 * Instances of the class [Response] represent a response to a request. |
| 462 */ | 462 */ |
| 463 class Response { | 463 class Response { |
| 464 /** | 464 /** |
| 465 * The [Response] instance that is returned when a real [Response] cannot |
| 466 * be provided at the moment. |
| 467 */ |
| 468 static final Response DELAYED_RESPONSE = new Response('DELAYED_RESPONSE'); |
| 469 |
| 470 /** |
| 465 * The name of the JSON attribute containing the id of the request for which | 471 * The name of the JSON attribute containing the id of the request for which |
| 466 * this is a response. | 472 * this is a response. |
| 467 */ | 473 */ |
| 468 static const String ID = 'id'; | 474 static const String ID = 'id'; |
| 469 | 475 |
| 470 /** | 476 /** |
| 471 * The name of the JSON attribute containing the error message. | 477 * The name of the JSON attribute containing the error message. |
| 472 */ | 478 */ |
| 473 static const String ERROR = 'error'; | 479 static const String ERROR = 'error'; |
| 474 | 480 |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 */ | 931 */ |
| 926 _toJson(Object value) { | 932 _toJson(Object value) { |
| 927 if (value is HasToJson) { | 933 if (value is HasToJson) { |
| 928 return value.toJson(); | 934 return value.toJson(); |
| 929 } | 935 } |
| 930 if (value is Iterable) { | 936 if (value is Iterable) { |
| 931 return value.map((item) => _toJson(item)).toList(); | 937 return value.map((item) => _toJson(item)).toList(); |
| 932 } | 938 } |
| 933 return value; | 939 return value; |
| 934 } | 940 } |
| OLD | NEW |