Index: pkg/analysis_server/lib/src/services/refactoring/extract_local.dart |
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart |
index d24ccd9496fd17b61079ae5cc72f613ccd6a2e9f..ca90fd2616e48535ddfecbfbd667af387c618e33 100644 |
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart |
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart |
@@ -76,11 +76,7 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl |
@override |
Future<RefactoringStatus> checkFinalConditions() { |
RefactoringStatus result = new RefactoringStatus(); |
- if (excludedVariableNames.contains(name)) { |
- result.addWarning(format( |
- "A variable with name '{0}' is already defined in the visible scope.", |
- name)); |
- } |
+ result.addStatus(checkName()); |
return new Future.value(result); |
} |
@@ -105,7 +101,13 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl |
@override |
RefactoringStatus checkName() { |
- return validateVariableName(name); |
+ RefactoringStatus result = new RefactoringStatus(); |
+ result.addStatus(validateVariableName(name)); |
+ if (excludedVariableNames.contains(name)) { |
+ result.addError( |
+ format("The name '{0}' is already used in the scope.", name)); |
+ } |
+ return result; |
} |
@override |