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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 103 // ignore references from SDK and pub cache |
104 if (isElementInSdkOrPubCache(reference.element)) { | 104 if (isElementInSdkOrPubCache(reference.element)) { |
105 print('ignore: $reference'); | |
106 continue; | 105 continue; |
107 } | 106 } |
108 // check the element being renamed is accessible | 107 // check the element being renamed is accessible |
109 { | 108 { |
110 LibraryElement whereLibrary = reference.element.library; | 109 LibraryElement whereLibrary = reference.element.library; |
111 if (!element.isAccessibleIn(whereLibrary)) { | 110 if (!element.isAccessibleIn(whereLibrary)) { |
112 continue; | 111 continue; |
113 } | 112 } |
114 } | 113 } |
115 // add edit | 114 // add edit |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 Element refElement = reference.element; | 286 Element refElement = reference.element; |
288 LibraryElement refLibrary = refElement.library; | 287 LibraryElement refLibrary = refElement.library; |
289 if (refLibrary != library) { | 288 if (refLibrary != library) { |
290 String message = format("Renamed {0} will be invisible in '{1}'.", | 289 String message = format("Renamed {0} will be invisible in '{1}'.", |
291 getElementKindName(element), getElementQualifiedName(refLibrary)); | 290 getElementKindName(element), getElementQualifiedName(refLibrary)); |
292 result.addError(message, newLocation_fromMatch(reference)); | 291 result.addError(message, newLocation_fromMatch(reference)); |
293 } | 292 } |
294 } | 293 } |
295 } | 294 } |
296 } | 295 } |
OLD | NEW |