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

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 1650853002: Issue 25622. Quick fix for 'async-for'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698