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 af6b309cce504468313d2931e1ec14968189c879..423f1c7c32dac42f2f0221487a8f7cd2fe734a80 100644 |
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart |
@@ -292,18 +292,18 @@ class FixProcessor { |
StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS) { |
_addFix_updateConstructor_forUninitializedFinalFields(); |
} |
+ if (errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT) { |
+ _addFix_addAsync(); |
Brian Wilkerson
2016/07/18 17:39:40
Shouldn't the fixes for UNDEFINED_IDENTIFIER also
scheglov
2016/07/18 17:47:43
I don't think so.
As I can see in ElementResolver,
Brian Wilkerson
2016/07/18 17:56:20
Exactly. But given that 'await' is a valid name fo
scheglov
2016/07/18 18:10:11
You are right, it is possible to use "await" in so
|
+ } |
if (errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER) { |
- bool isAsync = _addFix_addAsync(); |
- if (!isAsync) { |
- _addFix_undefinedClassAccessor_useSimilar(); |
- _addFix_createClass(); |
- _addFix_createField(); |
- _addFix_createGetter(); |
- _addFix_createFunction_forFunctionType(); |
- _addFix_importLibrary_withType(); |
- _addFix_importLibrary_withTopLevelVariable(); |
- _addFix_createLocalVariable(); |
- } |
+ _addFix_undefinedClassAccessor_useSimilar(); |
+ _addFix_createClass(); |
+ _addFix_createField(); |
+ _addFix_createGetter(); |
+ _addFix_createFunction_forFunctionType(); |
+ _addFix_importLibrary_withType(); |
+ _addFix_importLibrary_withTopLevelVariable(); |
+ _addFix_createLocalVariable(); |
} |
if (errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE) { |
_addFix_illegalAsyncReturnType(); |
@@ -397,14 +397,12 @@ class FixProcessor { |
*/ |
bool _addFix_addAsync() { |
AstNode node = this.node; |
- if (_isAwaitNode()) { |
- FunctionBody body = node.getAncestor((n) => n is FunctionBody); |
- if (body != null && body.keyword == null) { |
- _addReplaceEdit(rf.rangeStartLength(body, 0), 'async '); |
- _replaceReturnTypeWithFuture(body); |
- _addFix(DartFixKind.ADD_ASYNC, []); |
- return true; |
- } |
+ FunctionBody body = node.getAncestor((n) => n is FunctionBody); |
+ if (body != null && body.keyword == null) { |
+ _addReplaceEdit(rf.rangeStartLength(body, 0), 'async '); |
+ _replaceReturnTypeWithFuture(body); |
+ _addFix(DartFixKind.ADD_ASYNC, []); |
+ return true; |
} |
return false; |
} |