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

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

Issue 485083004: Make RefactoringStatus a collection of generated RefactoringProblems. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.src.refactoring.rename_local; 5 library services.src.refactoring.rename_local;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/services/correction/change.dart'; 9 import 'package:analysis_server/src/services/correction/change.dart';
10 import 'package:analysis_server/src/services/correction/status.dart'; 10 import 'package:analysis_server/src/services/correction/status.dart';
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 Object visitSimpleIdentifier(SimpleIdentifier node) { 114 Object visitSimpleIdentifier(SimpleIdentifier node) {
115 Element nodeElement = node.bestElement; 115 Element nodeElement = node.bestElement;
116 String newName = refactoring.newName; 116 String newName = refactoring.newName;
117 if (nodeElement != null && nodeElement.name == newName) { 117 if (nodeElement != null && nodeElement.name == newName) {
118 // duplicate declaration 118 // duplicate declaration
119 if (haveIntersectingRanges(refactoring.element, nodeElement)) { 119 if (haveIntersectingRanges(refactoring.element, nodeElement)) {
120 String nodeKind = nodeElement.kind.displayName; 120 String nodeKind = nodeElement.kind.displayName;
121 String message = "Duplicate ${nodeKind} '$newName'."; 121 String message = "Duplicate ${nodeKind} '$newName'.";
122 result.addError( 122 result.addError(
123 message, 123 message,
124 new RefactoringStatusContext.forElement(nodeElement)); 124 createLocation_forElement(nodeElement));
125 return null; 125 return null;
126 } 126 }
127 // shadowing referenced element 127 // shadowing referenced element
128 if (elementRange.contains(node.offset) && !node.isQualified) { 128 if (elementRange.contains(node.offset) && !node.isQualified) {
129 nodeElement = getSyntheticAccessorVariable(nodeElement); 129 nodeElement = getSyntheticAccessorVariable(nodeElement);
130 String nodeKind = nodeElement.kind.displayName; 130 String nodeKind = nodeElement.kind.displayName;
131 String nodeName = getElementQualifiedName(nodeElement); 131 String nodeName = getElementQualifiedName(nodeElement);
132 String nameElementSourceName = nodeElement.source.shortName; 132 String nameElementSourceName = nodeElement.source.shortName;
133 String refKind = refactoring.element.kind.displayName; 133 String refKind = refactoring.element.kind.displayName;
134 String message = 134 String message =
135 'Usage of $nodeKind "$nodeName" declared in ' 135 'Usage of $nodeKind "$nodeName" declared in '
136 '"$nameElementSourceName" will be shadowed by renamed $refKind.' ; 136 '"$nameElementSourceName" will be shadowed by renamed $refKind.' ;
137 result.addError(message, new RefactoringStatusContext.forNode(node)); 137 result.addError(message, createLocation_forNode(node));
138 } 138 }
139 } 139 }
140 return null; 140 return null;
141 } 141 }
142 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698