| Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
|
| index fa16435cc086168fed1848b55c8c87e69ec507ee..a400a0cd5f0fffd706a15639ab8df5bfab4cf529 100644
|
| --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
|
| +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
|
| @@ -149,6 +149,9 @@ class FixProcessor {
|
| CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE) {
|
| _addFix_replaceWithConstInstanceCreation();
|
| }
|
| + if (errorCode == CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT) {
|
| + bool isAsync = _addFix_addAsync_asyncFor();
|
| + }
|
| if (errorCode == CompileTimeErrorCode.INVALID_ANNOTATION) {
|
| if (node is Annotation) {
|
| Annotation annotation = node;
|
| @@ -394,6 +397,14 @@ class FixProcessor {
|
| return false;
|
| }
|
|
|
| + void _addFix_addAsync_asyncFor() {
|
| + FunctionBody body = node.getAncestor((n) => n is FunctionBody);
|
| + if (body != null && body.keyword == null) {
|
| + _addReplaceEdit(rf.rangeStartLength(body, 0), 'async ');
|
| + _addFix(DartFixKind.ADD_ASYNC, []);
|
| + }
|
| + }
|
| +
|
| void _addFix_addMissingParameter() {
|
| if (node is ArgumentList && node.parent is MethodInvocation) {
|
| ArgumentList argumentList = node;
|
|
|