| 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 &&
|
|
|