Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: pkg/analysis_server/lib/src/channel/byte_stream_channel.dart

Issue 2198223002: Mark analysis_server as being strong-mode clean (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 channel.byte_stream; 5 library channel.byte_stream;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 .transform(new NotificationConverter()) 44 .transform(new NotificationConverter())
45 .asBroadcastStream(); 45 .asBroadcastStream();
46 } 46 }
47 47
48 @override 48 @override
49 Future close() { 49 Future close() {
50 return output.close(); 50 return output.close();
51 } 51 }
52 52
53 @override 53 @override
54 Future<Response> sendRequest(Request request) { 54 Future<Response> sendRequest(Request request) async {
55 String id = request.id; 55 String id = request.id;
56 output.write(JSON.encode(request.toJson()) + '\n'); 56 output.write(JSON.encode(request.toJson()) + '\n');
57 return responseStream.firstWhere((Response response) => response.id == id); 57 return await responseStream
58 .firstWhere((Response response) => response.id == id);
58 } 59 }
59 } 60 }
60 61
61 /** 62 /**
62 * Instances of the class [ByteStreamServerChannel] implement a 63 * Instances of the class [ByteStreamServerChannel] implement a
63 * [ServerCommunicationChannel] that uses a stream and a sink (typically, 64 * [ServerCommunicationChannel] that uses a stream and a sink (typically,
64 * standard input and standard output) to communicate with clients. 65 * standard input and standard output) to communicate with clients.
65 */ 66 */
66 class ByteStreamServerChannel implements ServerCommunicationChannel { 67 class ByteStreamServerChannel implements ServerCommunicationChannel {
67 final Stream _input; 68 final Stream _input;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // structure as a request. 164 // structure as a request.
164 Request request = new Request.fromString(data); 165 Request request = new Request.fromString(data);
165 if (request == null) { 166 if (request == null) {
166 sendResponse(new Response.invalidRequestFormat()); 167 sendResponse(new Response.invalidRequestFormat());
167 return; 168 return;
168 } 169 }
169 onRequest(request); 170 onRequest(request);
170 }); 171 });
171 } 172 }
172 } 173 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/.analysis_options ('k') | pkg/analysis_server/lib/src/channel/web_socket_channel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698