| 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.dart' hide Element, ElementKind; | 9 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; |
| 10 import 'package:analysis_server/src/services/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 }).then((_) => result); | 231 }).then((_) => result); |
| 232 } | 232 } |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * Fills [elements] with [Element]s to rename. | 235 * Fills [elements] with [Element]s to rename. |
| 236 */ | 236 */ |
| 237 Future _prepareElements() { | 237 Future _prepareElements() { |
| 238 if (element is ClassMemberElement) { | 238 if (element is ClassMemberElement) { |
| 239 return getHierarchyMembers( | 239 return getHierarchyMembers( |
| 240 searchEngine, | 240 searchEngine, |
| 241 element, | 241 element).then((Set<Element> elements) { |
| 242 false).then((Set<Element> elements) { | |
| 243 this.elements = elements; | 242 this.elements = elements; |
| 244 }); | 243 }); |
| 245 } else { | 244 } else { |
| 246 elements = new Set.from([element]); | 245 elements = new Set.from([element]); |
| 247 return new Future.value(); | 246 return new Future.value(); |
| 248 } | 247 } |
| 249 } | 248 } |
| 250 | 249 |
| 251 /** | 250 /** |
| 252 * Fills [references] with all references to [elements]. | 251 * Fills [references] with all references to [elements]. |
| 253 */ | 252 */ |
| 254 Future _prepareReferences() { | 253 Future _prepareReferences() { |
| 255 if (!isRename) { | 254 if (!isRename) { |
| 256 return new Future.value(); | 255 return new Future.value(); |
| 257 } | 256 } |
| 258 return _prepareElements().then((_) { | 257 return _prepareElements().then((_) { |
| 259 return Future.forEach(elements, (Element element) { | 258 return Future.forEach(elements, (Element element) { |
| 260 return searchEngine.searchReferences(element).then((references) { | 259 return searchEngine.searchReferences(element).then((references) { |
| 261 this.references.addAll(references); | 260 this.references.addAll(references); |
| 262 }); | 261 }); |
| 263 }); | 262 }); |
| 264 }); | 263 }); |
| 265 } | 264 } |
| 266 } | 265 } |
| OLD | NEW |