OLD | NEW |
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_class_member; | 5 library services.src.refactoring.rename_class_member; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/protocol_server.dart' | 9 import 'package:analysis_server/src/protocol_server.dart' |
10 hide Element, ElementKind; | 10 hide Element, ElementKind; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 addReferenceEdits(_validator.references); | 93 addReferenceEdits(_validator.references); |
94 // potential matches | 94 // potential matches |
95 List<SearchMatch> nameMatches = | 95 List<SearchMatch> nameMatches = |
96 await searchEngine.searchMemberReferences(oldName); | 96 await searchEngine.searchMemberReferences(oldName); |
97 List<SourceReference> nameRefs = getSourceReferences(nameMatches); | 97 List<SourceReference> nameRefs = getSourceReferences(nameMatches); |
98 for (SourceReference reference in nameRefs) { | 98 for (SourceReference reference in nameRefs) { |
99 // ignore resolved reference, we have already updated it | 99 // ignore resolved reference, we have already updated it |
100 if (reference.isResolved) { | 100 if (reference.isResolved) { |
101 continue; | 101 continue; |
102 } | 102 } |
| 103 // ignore references from SDK and pub cache |
| 104 if (isElementInSdkOrPubCache(reference.element)) { |
| 105 print('ignore: $reference'); |
| 106 continue; |
| 107 } |
103 // check the element being renamed is accessible | 108 // check the element being renamed is accessible |
104 { | 109 { |
105 LibraryElement whereLibrary = reference.element.library; | 110 LibraryElement whereLibrary = reference.element.library; |
106 if (!element.isAccessibleIn(whereLibrary)) { | 111 if (!element.isAccessibleIn(whereLibrary)) { |
107 continue; | 112 continue; |
108 } | 113 } |
109 } | 114 } |
110 // add edit | 115 // add edit |
111 reference.addEdit(change, newName, id: _newPotentialId()); | 116 reference.addEdit(change, newName, id: _newPotentialId()); |
112 } | 117 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 Element refElement = reference.element; | 264 Element refElement = reference.element; |
260 LibraryElement refLibrary = refElement.library; | 265 LibraryElement refLibrary = refElement.library; |
261 if (refLibrary != library) { | 266 if (refLibrary != library) { |
262 String message = format("Renamed {0} will be invisible in '{1}'.", | 267 String message = format("Renamed {0} will be invisible in '{1}'.", |
263 getElementKindName(element), getElementQualifiedName(refLibrary)); | 268 getElementKindName(element), getElementQualifiedName(refLibrary)); |
264 result.addError(message, newLocation_fromMatch(reference)); | 269 result.addError(message, newLocation_fromMatch(reference)); |
265 } | 270 } |
266 } | 271 } |
267 } | 272 } |
268 } | 273 } |
OLD | NEW |