OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:collection'; | |
6 | |
7 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; | 5 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; |
8 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; | 6 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; |
9 | 7 |
10 /** | 8 /** |
11 * An interface for enumerated types in the protocol. | 9 * An interface for enumerated types in the protocol. |
12 * | 10 * |
13 * Clients may not extend, implement or mix-in this class. | 11 * Clients may not extend, implement or mix-in this class. |
14 */ | 12 */ |
15 abstract class Enum { | 13 abstract class Enum { |
16 /** | 14 /** |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } catch (exception) { | 561 } catch (exception) { |
564 return null; | 562 return null; |
565 } | 563 } |
566 } | 564 } |
567 | 565 |
568 /** | 566 /** |
569 * Return a table representing the structure of the Json object that will be | 567 * Return a table representing the structure of the Json object that will be |
570 * sent to the client to represent this response. | 568 * sent to the client to represent this response. |
571 */ | 569 */ |
572 Map<String, Object> toJson() { | 570 Map<String, Object> toJson() { |
573 Map<String, Object> jsonObject = new HashMap<String, Object>(); | 571 Map<String, Object> jsonObject = <String, Object>{}; |
574 jsonObject[ID] = id; | 572 jsonObject[ID] = id; |
575 if (error != null) { | 573 if (error != null) { |
576 jsonObject[ERROR] = error.toJson(); | 574 jsonObject[ERROR] = error.toJson(); |
577 } | 575 } |
578 if (result != null) { | 576 if (result != null) { |
579 jsonObject[RESULT] = result; | 577 jsonObject[RESULT] = result; |
580 } | 578 } |
581 return jsonObject; | 579 return jsonObject; |
582 } | 580 } |
583 } | 581 } |
OLD | NEW |