Skip to content

Commit 12dcfe6

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Start removing extraneous awaits from server
Change-Id: I484227773e98d87c915f6dfe6e320dda1a7b8eaa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144862 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent a53d336 commit 12dcfe6

File tree

11 files changed

+0
-75
lines changed

11 files changed

+0
-75
lines changed

pkg/analysis_server/lib/src/channel/byte_stream_channel.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class ByteStreamClientChannel implements ClientCommunicationChannel {
4949

5050
@override
5151
Future<Response> sendRequest(Request request) async {
52-
// TODO(brianwilkerson) Determine whether this await is necessary.
53-
await null;
5452
var id = request.id;
5553
output.write(json.encode(request.toJson()) + '\n');
5654
return await responseStream

pkg/analysis_server/lib/src/computer/import_elements_computer.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class ImportElementsComputer {
3838
/// imported into the library at the given [path].
3939
Future<SourceChange> createEdits(
4040
List<ImportedElements> importedElementsList) async {
41-
// TODO(brianwilkerson) Determine whether this await is necessary.
42-
await null;
4341
var filteredImportedElements =
4442
_filterImportedElements(importedElementsList);
4543
var libraryElement = libraryResult.libraryElement;

pkg/analysis_server/lib/src/domains/execution/completion.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ class RuntimeCompletionComputer {
4444
this.expressions);
4545

4646
Future<RuntimeCompletionResult> compute() async {
47-
// TODO(brianwilkerson) Determine whether this await is necessary.
48-
await null;
4947
var contextResult = await analysisDriver.getResult(contextPath);
5048
var session = contextResult.session;
5149

pkg/analysis_server/lib/src/edit/edit_domain.dart

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ class EditDomainHandler extends AbstractRequestHandler {
165165
}
166166

167167
Future getAssists(Request request) async {
168-
// TODO(brianwilkerson) Determine whether this await is necessary.
169-
await null;
170168
var params = EditGetAssistsParams.fromRequest(request);
171169
var file = params.file;
172170
var offset = params.offset;
@@ -287,8 +285,6 @@ class EditDomainHandler extends AbstractRequestHandler {
287285
}
288286

289287
Future getPostfixCompletion(Request request) async {
290-
// TODO(brianwilkerson) Determine whether this await is necessary.
291-
await null;
292288
server.options.analytics?.sendEvent('edit', 'getPostfixCompletion');
293289

294290
var params = EditGetPostfixCompletionParams.fromRequest(request);
@@ -319,9 +315,6 @@ class EditDomainHandler extends AbstractRequestHandler {
319315
}
320316

321317
Future getStatementCompletion(Request request) async {
322-
// TODO(brianwilkerson) Determine whether this await is necessary.
323-
await null;
324-
325318
var params = EditGetStatementCompletionParams.fromRequest(request);
326319
var file = params.file;
327320

@@ -396,9 +389,6 @@ class EditDomainHandler extends AbstractRequestHandler {
396389

397390
/// Implement the `edit.importElements` request.
398391
Future<void> importElements(Request request) async {
399-
// TODO(brianwilkerson) Determine whether this await is necessary.
400-
await null;
401-
402392
var params = EditImportElementsParams.fromRequest(request);
403393
var file = params.file;
404394

@@ -437,8 +427,6 @@ class EditDomainHandler extends AbstractRequestHandler {
437427
}
438428

439429
Future isPostfixCompletionApplicable(Request request) async {
440-
// TODO(brianwilkerson) Determine whether this await is necessary.
441-
await null;
442430
var params = EditGetPostfixCompletionParams.fromRequest(request);
443431
var file = params.file;
444432

@@ -475,8 +463,6 @@ class EditDomainHandler extends AbstractRequestHandler {
475463
}
476464

477465
Future<void> organizeDirectives(Request request) async {
478-
// TODO(brianwilkerson) Determine whether this await is necessary.
479-
await null;
480466
server.options.analytics?.sendEvent('edit', 'organizeDirectives');
481467

482468
var params = EditOrganizeDirectivesParams.fromRequest(request);
@@ -516,8 +502,6 @@ class EditDomainHandler extends AbstractRequestHandler {
516502
}
517503

518504
Future<void> sortMembers(Request request) async {
519-
// TODO(brianwilkerson) Determine whether this await is necessary.
520-
await null;
521505
var params = EditSortMembersParams.fromRequest(request);
522506
var file = params.file;
523507

@@ -922,8 +906,6 @@ class _RefactoringManager {
922906
}
923907

924908
runZonedGuarded(() async {
925-
// TODO(brianwilkerson) Determine whether this await is necessary.
926-
await null;
927909
await _init(params.kind, file, params.offset, params.length);
928910
if (initStatus.hasFatalError) {
929911
feedback = null;
@@ -1013,8 +995,6 @@ class _RefactoringManager {
1013995
/// parameters. The existing [Refactoring] is reused or created as needed.
1014996
Future _init(
1015997
RefactoringKind kind, String file, int offset, int length) async {
1016-
// TODO(brianwilkerson) Determine whether this await is necessary.
1017-
await null;
1018998
// check if we can continue with the existing Refactoring instance
1019999
if (this.kind == kind &&
10201000
this.file == file &&

pkg/analysis_server/lib/src/operation/operation_analysis.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import 'package:analyzer/src/generated/source.dart';
2121

2222
Future<void> scheduleImplementedNotification(
2323
AnalysisServer server, Iterable<String> files) async {
24-
// TODO(brianwilkerson) Determine whether this await is necessary.
25-
await null;
2624
var searchEngine = server.searchEngine;
2725
if (searchEngine == null) {
2826
return;

pkg/analysis_server/lib/src/plugin/plugin_manager.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ abstract class PluginInfo {
195195
/// used to interact with the plugin, or `null` if the plugin could not be
196196
/// run.
197197
Future<PluginSession> start(String byteStorePath, String sdkPath) async {
198-
// TODO(brianwilkerson) Determine whether this await is necessary.
199-
await null;
200198
if (currentSession != null) {
201199
throw StateError('Cannot start a plugin that is already running.');
202200
}
@@ -299,8 +297,6 @@ class PluginManager {
299297
/// not yet been started, then it will be started by this method.
300298
Future<void> addPluginToContextRoot(
301299
analyzer.ContextRoot contextRoot, String path) async {
302-
// TODO(brianwilkerson) Determine whether this await is necessary.
303-
await null;
304300
var plugin = _pluginMap[path];
305301
var isNew = plugin == null;
306302
if (isNew) {
@@ -372,8 +368,6 @@ class PluginManager {
372368
/// response.
373369
Future<List<Future<Response>>> broadcastWatchEvent(
374370
watcher.WatchEvent watchEvent) async {
375-
// TODO(brianwilkerson) Determine whether this await is necessary.
376-
await null;
377371
var filePath = watchEvent.path;
378372

379373
/// Return `true` if the given glob [pattern] matches the file being
@@ -490,8 +484,6 @@ class PluginManager {
490484

491485
/// Restart all currently running plugins.
492486
Future<void> restartPlugins() async {
493-
// TODO(brianwilkerson) Determine whether this await is necessary.
494-
await null;
495487
for (var plugin in _pluginMap.values.toList()) {
496488
if (plugin.currentSession != null) {
497489
//
@@ -904,8 +896,6 @@ class PluginSession {
904896
/// the given [byteStorePath]. Return `true` if the plugin is compatible and
905897
/// running.
906898
Future<bool> start(String byteStorePath, String sdkPath) async {
907-
// TODO(brianwilkerson) Determine whether this await is necessary.
908-
await null;
909899
if (channel != null) {
910900
throw StateError('Cannot start a plugin that is already running.');
911901
}

pkg/analysis_server/lib/src/search/element_references.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class ElementReferencesComputer {
1919
/// Computes [SearchResult]s for [element] references.
2020
Future<List<SearchResult>> compute(
2121
Element element, bool withPotential) async {
22-
// TODO(brianwilkerson) Determine whether this await is necessary.
23-
await null;
2422
var results = <SearchResult>[];
2523

2624
// Add element references.
@@ -40,8 +38,6 @@ class ElementReferencesComputer {
4038
/// Returns a [Future] completing with a [List] of references to [element] or
4139
/// to the corresponding hierarchy [Element]s.
4240
Future<List<SearchResult>> _findElementsReferences(Element element) async {
43-
// TODO(brianwilkerson) Determine whether this await is necessary.
44-
await null;
4541
var allResults = <SearchResult>[];
4642
var refElements = await _getRefElements(element);
4743
for (var refElement in refElements) {
@@ -54,8 +50,6 @@ class ElementReferencesComputer {
5450
/// Returns a [Future] completing with a [List] of references to [element].
5551
Future<List<SearchResult>> _findSingleElementReferences(
5652
Element element) async {
57-
// TODO(brianwilkerson) Determine whether this await is necessary.
58-
await null;
5953
var matches = await searchEngine.searchReferences(element);
6054
matches = SearchMatch.withNotNullElement(matches);
6155
return matches.map(toResult).toList();

pkg/analysis_server/lib/src/search/search_domain.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ class SearchDomainHandler implements protocol.RequestHandler {
3232
searchEngine = server.searchEngine;
3333

3434
Future findElementReferences(protocol.Request request) async {
35-
// TODO(brianwilkerson) Determine whether this await is necessary.
36-
await null;
3735
var params =
3836
protocol.SearchFindElementReferencesParams.fromRequest(request);
3937
var file = params.file;
@@ -65,8 +63,6 @@ class SearchDomainHandler implements protocol.RequestHandler {
6563
}
6664

6765
Future findMemberDeclarations(protocol.Request request) async {
68-
// TODO(brianwilkerson) Determine whether this await is necessary.
69-
await null;
7066
var params =
7167
protocol.SearchFindMemberDeclarationsParams.fromRequest(request);
7268
await server.onAnalysisComplete;
@@ -81,8 +77,6 @@ class SearchDomainHandler implements protocol.RequestHandler {
8177
}
8278

8379
Future findMemberReferences(protocol.Request request) async {
84-
// TODO(brianwilkerson) Determine whether this await is necessary.
85-
await null;
8680
var params = protocol.SearchFindMemberReferencesParams.fromRequest(request);
8781
await server.onAnalysisComplete;
8882
// respond
@@ -96,8 +90,6 @@ class SearchDomainHandler implements protocol.RequestHandler {
9690
}
9791

9892
Future findTopLevelDeclarations(protocol.Request request) async {
99-
// TODO(brianwilkerson) Determine whether this await is necessary.
100-
await null;
10193
var params =
10294
protocol.SearchFindTopLevelDeclarationsParams.fromRequest(request);
10395
try {
@@ -122,8 +114,6 @@ class SearchDomainHandler implements protocol.RequestHandler {
122114

123115
/// Implement the `search.getDeclarations` request.
124116
Future getDeclarations(protocol.Request request) async {
125-
// TODO(brianwilkerson) Determine whether this await is necessary.
126-
await null;
127117
var params =
128118
protocol.SearchGetElementDeclarationsParams.fromRequest(request);
129119

@@ -203,8 +193,6 @@ class SearchDomainHandler implements protocol.RequestHandler {
203193

204194
/// Implement the `search.getTypeHierarchy` request.
205195
Future getTypeHierarchy(protocol.Request request) async {
206-
// TODO(brianwilkerson) Determine whether this await is necessary.
207-
await null;
208196
var params = protocol.SearchGetTypeHierarchyParams.fromRequest(request);
209197
var file = params.file;
210198
// prepare element

pkg/analysis_server/lib/src/server/driver.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,6 @@ class Driver implements ServerStarter {
613613
serveResult = isolateAnalysisServer.serveIsolate(sendPort);
614614
}
615615
serveResult.then((_) async {
616-
// TODO(brianwilkerson) Determine whether this await is necessary.
617-
await null;
618-
619616
if (serve_http) {
620617
httpServer.close();
621618
}

pkg/analysis_server/lib/src/server/http_server.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class HttpAnalysisServer {
4141

4242
/// Return the port this server is bound to.
4343
Future<int> get boundPort async {
44-
// TODO(brianwilkerson) Determine whether this await is necessary.
45-
await null;
4644
return (await _serverFuture)?.port;
4745
}
4846

@@ -63,8 +61,6 @@ class HttpAnalysisServer {
6361

6462
/// Begin serving HTTP requests over the given port.
6563
Future<int> serveHttp([int initialPort]) async {
66-
// TODO(brianwilkerson) Determine whether this await is necessary.
67-
await null;
6864
if (_serverFuture != null) {
6965
return boundPort;
7066
}
@@ -87,8 +83,6 @@ class HttpAnalysisServer {
8783

8884
/// Handle a GET request received by the HTTP server.
8985
Future<void> _handleGetRequest(HttpRequest request) async {
90-
// TODO(brianwilkerson) Determine whether this await is necessary.
91-
await null;
9286
getHandler ??= DiagnosticsSite(socketServer, _printBuffer);
9387
// TODO(brianwilkerson) Determine if await is necessary, if so, change the
9488
// return type of [AbstractGetHandler.handleGetRequest] to `Future<void>`.
@@ -98,8 +92,6 @@ class HttpAnalysisServer {
9892
/// Attach a listener to a newly created HTTP server.
9993
void _handleServer(HttpServer httpServer) {
10094
httpServer.listen((HttpRequest request) async {
101-
// TODO(brianwilkerson) Determine whether this await is necessary.
102-
await null;
10395
var updateValues = request.headers[HttpHeaders.upgradeHeader];
10496
if (request.method == 'GET') {
10597
await _handleGetRequest(request);

0 commit comments

Comments
 (0)