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:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; | 10 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 if (messageAsMap.containsKey('id')) { | 551 if (messageAsMap.containsKey('id')) { |
552 outOfTestExpect(messageAsMap['id'], isString); | 552 outOfTestExpect(messageAsMap['id'], isString); |
553 String id = message['id']; | 553 String id = message['id']; |
554 Completer completer = _pendingCommands[id]; | 554 Completer completer = _pendingCommands[id]; |
555 if (completer == null) { | 555 if (completer == null) { |
556 fail('Unexpected response from server: id=$id'); | 556 fail('Unexpected response from server: id=$id'); |
557 } else { | 557 } else { |
558 _pendingCommands.remove(id); | 558 _pendingCommands.remove(id); |
559 } | 559 } |
560 if (messageAsMap.containsKey('error')) { | 560 if (messageAsMap.containsKey('error')) { |
561 // TODO(paulberry): propagate the error info to the completer. | 561 completer.completeError(messageAsMap['error']); |
Paul Berry
2017/02/12 14:39:04
Hmm, when did this code get duplicated? We should
Brian Wilkerson
2017/02/12 16:41:54
It was duplicated when I created the analyzer_plug
devoncarew
2017/02/12 17:52:34
Is it important to keep this files in sync? If so,
Brian Wilkerson
2017/02/12 18:47:09
That depends on what you mean by "important". :-)
| |
562 completer.completeError(new UnimplementedError( | |
563 'Server responded with an error: ${JSON.encode(message)}')); | |
564 } else { | 562 } else { |
565 completer.complete(messageAsMap['result']); | 563 completer.complete(messageAsMap['result']); |
566 } | 564 } |
567 // Check that the message is well-formed. We do this after calling | 565 // Check that the message is well-formed. We do this after calling |
568 // completer.complete() or completer.completeError() so that we don't | 566 // completer.complete() or completer.completeError() so that we don't |
569 // stall the test in the event of an error. | 567 // stall the test in the event of an error. |
570 outOfTestExpect(message, isResponse); | 568 outOfTestExpect(message, isResponse); |
571 } else { | 569 } else { |
572 // Message is a notification. It should have an event and possibly | 570 // Message is a notification. It should have an event and possibly |
573 // params. | 571 // params. |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
941 void populateMismatches(item, List<MismatchDescriber> mismatches); | 939 void populateMismatches(item, List<MismatchDescriber> mismatches); |
942 | 940 |
943 /** | 941 /** |
944 * Create a [MismatchDescriber] describing a mismatch with a simple string. | 942 * Create a [MismatchDescriber] describing a mismatch with a simple string. |
945 */ | 943 */ |
946 MismatchDescriber simpleDescription(String description) => | 944 MismatchDescriber simpleDescription(String description) => |
947 (Description mismatchDescription) { | 945 (Description mismatchDescription) { |
948 mismatchDescription.add(description); | 946 mismatchDescription.add(description); |
949 }; | 947 }; |
950 } | 948 } |
OLD | NEW |