commit | 6875b9b26b06480b097b923e7617618161de82f8 | [log] [tgz] |
---|---|---|
author | Brian Wilkerson <brianwilkerson@google.com> | Mon Feb 11 01:31:52 2019 +0000 |
committer | commit-bot@chromium.org <commit-bot@chromium.org> | Mon Feb 11 01:31:52 2019 +0000 |
tree | 2e2429461450f8d8e07936cb61747ce99b46ff6f | |
parent | d32ca512ec5aa0393dfd53dbc00fedb5df2f3c21 [diff] |
Do not convert empty function bodies to async (issue 35899) Change-Id: Ie08504aa927b27f45cc6c02089cc679e3b9d2376 Reviewed-on: https://dart-review.googlesource.com/c/92537 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart index 1885c4e..dc17318 100644 --- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart +++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -1195,10 +1195,11 @@ } Future<void> _addProposal_convertToAsyncFunctionBody() async { - // TODO(brianwilkerson) Determine whether this await is necessary. - await null; FunctionBody body = getEnclosingFunctionBody(); - if (body == null || body.isAsynchronous || body.isGenerator) { + if (body == null || + body is EmptyFunctionBody || + body.isAsynchronous || + body.isGenerator) { _coverageMarker(); return; }
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart index 170a3c4..5e430f9 100644 --- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart +++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart
@@ -120,11 +120,7 @@ int m(); } '''); - await assertHasAssistAt('m()', ''' -abstract class C { - Future<int> m(); -} -'''); + await assertNoAssist(); } test_method_noReturnType() async {