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

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

Issue 2162523003: Use the new StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT error. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 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;
}
« 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