| 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 f2c810333bf9d7e31d97450452557dcbe6498429..ee5394209b9aa1390d9800b2fc2518f6518561b3 100644
|
| --- a/pkg/analysis_server/lib/src/protocol.dart
|
| +++ b/pkg/analysis_server/lib/src/protocol.dart
|
| @@ -7,6 +7,8 @@ library protocol;
|
| import 'dart:collection';
|
| import 'dart:convert' show JsonDecoder;
|
|
|
| +import 'package:analysis_server/src/collections.dart';
|
| +
|
| /**
|
| * An abstract enumeration.
|
| */
|
| @@ -616,7 +618,7 @@ class Response {
|
| * Set the value of the result field with the given [name] to the given [value].
|
| */
|
| void setResult(String name, Object value) {
|
| - result[name] = value;
|
| + result[name] = _toJson(value);
|
| }
|
|
|
| /**
|
| @@ -870,7 +872,7 @@ class Notification {
|
| * Set the value of the parameter with the given [name] to the given [value].
|
| */
|
| void setParameter(String name, Object value) {
|
| - params[name] = value;
|
| + params[name] = _toJson(value);
|
| }
|
|
|
| /**
|
| @@ -917,3 +919,16 @@ class RequestFailure implements Exception {
|
| */
|
| RequestFailure(this.response);
|
| }
|
| +
|
| +/**
|
| + * Returns a JSON presention of [value].
|
| + */
|
| +_toJson(Object value) {
|
| + if (value is HasToJson) {
|
| + return value.toJson();
|
| + }
|
| + if (value is Iterable) {
|
| + return value.map((item) => _toJson(item)).toList();
|
| + }
|
| + return value;
|
| +}
|
|
|