| 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; | 5 library services.src.refactoring; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/protocol.dart' hide Element; | 10 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| 11 import 'package:analysis_server/src/services/correction/status.dart'; | 11 import 'package:analysis_server/src/services/correction/status.dart'; |
| 12 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 12 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 13 import 'package:analysis_server/src/services/search/search_engine.dart'; | 13 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 14 import 'package:analyzer/src/generated/element.dart'; | 14 import 'package:analyzer/src/generated/element.dart'; |
| 15 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
| 16 | 16 |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * When a [Source] (a file) is used in more than one context, [SearchEngine] | 19 * When a [Source] (a file) is used in more than one context, [SearchEngine] |
| 20 * will return separate [SearchMatch]s for each context. But in rename | 20 * will return separate [SearchMatch]s for each context. But in rename |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return other.file == file && other.range == range; | 90 return other.file == file && other.range == range; |
| 91 } | 91 } |
| 92 return false; | 92 return false; |
| 93 } | 93 } |
| 94 | 94 |
| 95 /** | 95 /** |
| 96 * Adds the [SourceEdit] to replace this reference. | 96 * Adds the [SourceEdit] to replace this reference. |
| 97 */ | 97 */ |
| 98 void addEdit(SourceChange change, String newText, {String id}) { | 98 void addEdit(SourceChange change, String newText, {String id}) { |
| 99 SourceEdit edit = createEdit(newText, id: id); | 99 SourceEdit edit = createEdit(newText, id: id); |
| 100 change.addElementEdit(element, edit); | 100 doSourceChange_addElementEdit(change, element, edit); |
| 101 } | 101 } |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * Returns the [SourceEdit] to replace this reference. | 104 * Returns the [SourceEdit] to replace this reference. |
| 105 */ | 105 */ |
| 106 SourceEdit createEdit(String newText, {String id}) { | 106 SourceEdit createEdit(String newText, {String id}) { |
| 107 return new SourceEdit.range(range, newText, id: id); | 107 return newSourceEdit_range(range, newText, id: id); |
| 108 } | 108 } |
| 109 | 109 |
| 110 @override | 110 @override |
| 111 String toString() => '${file}@${range}'; | 111 String toString() => '${file}@${range}'; |
| 112 } | 112 } |
| OLD | NEW |