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

Unified Diff: pkg/analysis_server/lib/src/services/refactoring/extract_local.dart

Issue 1528013004: Issue 25253. Improve collecting names that may conflict with the extracted local variable. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
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

Powered by Google App Engine
This is Rietveld 408576698