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

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

Issue 576703004: Send final problems even if 'validateOnly'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Request expensive validation in 'checkFinalConditions'. Created 6 years, 3 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
Index: pkg/analysis_server/lib/src/services/refactoring/rename_local.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_local.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_local.dart
index 9e1ab328600c90f61632113ff44b81047af4ec4c..1a7a8a29a2a6ef57c78dfdc6ec2e586e800ba11c 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_local.dart
@@ -107,6 +107,7 @@ class _ConflictValidatorVisitor extends RecursiveAstVisitor {
final RenameLocalRefactoringImpl refactoring;
final RefactoringStatus result;
final SourceRange elementRange;
+ final Set<Element> conflictingLocals = new Set<Element>();
_ConflictValidatorVisitor(this.refactoring, this.result, this.elementRange);
@@ -116,12 +117,17 @@ class _ConflictValidatorVisitor extends RecursiveAstVisitor {
String newName = refactoring.newName;
if (nodeElement != null && nodeElement.name == newName) {
// duplicate declaration
- if (haveIntersectingRanges(refactoring.element, nodeElement)) {
+ if (node.inDeclarationContext() &&
+ haveIntersectingRanges(refactoring.element, nodeElement)) {
+ conflictingLocals.add(nodeElement);
String nodeKind = nodeElement.kind.displayName;
String message = "Duplicate ${nodeKind} '$newName'.";
result.addError(message, new Location.fromElement(nodeElement));
return;
}
+ if (conflictingLocals.contains(nodeElement)) {
+ return;
+ }
// shadowing referenced element
if (elementRange.contains(node.offset) &&
!node.isQualified &&
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698