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

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

Issue 1521883002: Fix lints: unnecessary_brace_in_string_interp (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 unified diff | Download patch
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/protocol_server.dart' hide Element; 9 import 'package:analysis_server/src/protocol_server.dart' hide Element;
10 import 'package:analysis_server/src/services/correction/status.dart'; 10 import 'package:analysis_server/src/services/correction/status.dart';
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 @override 135 @override
136 visitSimpleIdentifier(SimpleIdentifier node) { 136 visitSimpleIdentifier(SimpleIdentifier node) {
137 Element nodeElement = node.bestElement; 137 Element nodeElement = node.bestElement;
138 String newName = refactoring.newName; 138 String newName = refactoring.newName;
139 if (nodeElement != null && nodeElement.name == newName) { 139 if (nodeElement != null && nodeElement.name == newName) {
140 // duplicate declaration 140 // duplicate declaration
141 if (node.inDeclarationContext() && 141 if (node.inDeclarationContext() &&
142 haveIntersectingRanges(refactoring.element, nodeElement)) { 142 haveIntersectingRanges(refactoring.element, nodeElement)) {
143 conflictingLocals.add(nodeElement); 143 conflictingLocals.add(nodeElement);
144 String nodeKind = nodeElement.kind.displayName; 144 String nodeKind = nodeElement.kind.displayName;
145 String message = "Duplicate ${nodeKind} '$newName'."; 145 String message = "Duplicate $nodeKind '$newName'.";
146 result.addError(message, newLocation_fromElement(nodeElement)); 146 result.addError(message, newLocation_fromElement(nodeElement));
147 return; 147 return;
148 } 148 }
149 if (conflictingLocals.contains(nodeElement)) { 149 if (conflictingLocals.contains(nodeElement)) {
150 return; 150 return;
151 } 151 }
152 // shadowing referenced element 152 // shadowing referenced element
153 if (elementRange.contains(node.offset) && 153 if (elementRange.contains(node.offset) &&
154 !node.isQualified && 154 !node.isQualified &&
155 !_isNamedExpressionName(node)) { 155 !_isNamedExpressionName(node)) {
156 nodeElement = getSyntheticAccessorVariable(nodeElement); 156 nodeElement = getSyntheticAccessorVariable(nodeElement);
157 String nodeKind = nodeElement.kind.displayName; 157 String nodeKind = nodeElement.kind.displayName;
158 String nodeName = getElementQualifiedName(nodeElement); 158 String nodeName = getElementQualifiedName(nodeElement);
159 String nameElementSourceName = nodeElement.source.shortName; 159 String nameElementSourceName = nodeElement.source.shortName;
160 String refKind = refactoring.element.kind.displayName; 160 String refKind = refactoring.element.kind.displayName;
161 String message = 'Usage of $nodeKind "$nodeName" declared in ' 161 String message = 'Usage of $nodeKind "$nodeName" declared in '
162 '"$nameElementSourceName" will be shadowed by renamed $refKind.'; 162 '"$nameElementSourceName" will be shadowed by renamed $refKind.';
163 result.addError(message, newLocation_fromNode(node)); 163 result.addError(message, newLocation_fromNode(node));
164 } 164 }
165 } 165 }
166 } 166 }
167 167
168 static bool _isNamedExpressionName(SimpleIdentifier node) { 168 static bool _isNamedExpressionName(SimpleIdentifier node) {
169 return node.parent is Label && node.parent.parent is NamedExpression; 169 return node.parent is Label && node.parent.parent is NamedExpression;
170 } 170 }
171 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698