| 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.refactoring; | 5 library services.refactoring; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' show | 9 import 'package:analysis_server/src/protocol.dart' show |
| 10 RefactoringMethodParameter, SourceChange; | 10 RefactoringMethodParameter, SourceChange; |
| 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/extract_local.dart'; | 12 import 'package:analysis_server/src/services/refactoring/extract_local.dart'; |
| 13 import 'package:analysis_server/src/services/refactoring/extract_method.dart'; | 13 import 'package:analysis_server/src/services/refactoring/extract_method.dart'; |
| 14 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; |
| 14 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar
t'; | 15 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar
t'; |
| 15 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart
'; | 16 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart
'; |
| 16 import 'package:analysis_server/src/services/refactoring/rename_import.dart'; | 17 import 'package:analysis_server/src/services/refactoring/rename_import.dart'; |
| 17 import 'package:analysis_server/src/services/refactoring/rename_library.dart'; | 18 import 'package:analysis_server/src/services/refactoring/rename_library.dart'; |
| 18 import 'package:analysis_server/src/services/refactoring/rename_local.dart'; | 19 import 'package:analysis_server/src/services/refactoring/rename_local.dart'; |
| 19 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
'; | 20 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
'; |
| 20 import 'package:analysis_server/src/services/search/search_engine.dart'; | 21 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 21 import 'package:analyzer/src/generated/ast.dart'; | 22 import 'package:analyzer/src/generated/ast.dart'; |
| 22 import 'package:analyzer/src/generated/element.dart'; | 23 import 'package:analyzer/src/generated/element.dart'; |
| 23 | 24 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 * It does not perform all the checks (such as checking for conflicts with any | 172 * It does not perform all the checks (such as checking for conflicts with any |
| 172 * existing names in any of the scopes containing the current name), as many | 173 * existing names in any of the scopes containing the current name), as many |
| 173 * of these checkes require search engine. Use [checkFinalConditions] for this | 174 * of these checkes require search engine. Use [checkFinalConditions] for this |
| 174 * level of checking. | 175 * level of checking. |
| 175 */ | 176 */ |
| 176 RefactoringStatus checkName(); | 177 RefactoringStatus checkName(); |
| 177 } | 178 } |
| 178 | 179 |
| 179 | 180 |
| 180 /** | 181 /** |
| 182 * [Refactoring] to inline a local [VariableElement]. |
| 183 */ |
| 184 abstract class InlineLocalRefactoring implements Refactoring { |
| 185 /** |
| 186 * Returns a new [InlineLocalRefactoring] instance. |
| 187 */ |
| 188 factory InlineLocalRefactoring(SearchEngine searchEngine, |
| 189 CompilationUnit unit, LocalVariableElement element) { |
| 190 return new InlineLocalRefactoringImpl(searchEngine, unit, element); |
| 191 } |
| 192 |
| 193 /** |
| 194 * Returns the number of references to the [VariableElement]. |
| 195 */ |
| 196 int get referenceCount; |
| 197 } |
| 198 |
| 199 |
| 200 /** |
| 181 * Abstract interface for all refactorings. | 201 * Abstract interface for all refactorings. |
| 182 */ | 202 */ |
| 183 abstract class Refactoring { | 203 abstract class Refactoring { |
| 184 /** | 204 /** |
| 185 * The ids of source edits that are not known to be valid. | 205 * The ids of source edits that are not known to be valid. |
| 186 * | 206 * |
| 187 * An edit is not known to be valid if there was insufficient type information | 207 * An edit is not known to be valid if there was insufficient type information |
| 188 * for the server to be able to determine whether or not the code needs to be | 208 * for the server to be able to determine whether or not the code needs to be |
| 189 * modified, such as when a member is being renamed and there is a reference | 209 * modified, such as when a member is being renamed and there is a reference |
| 190 * to a member from an unknown type. This field will be omitted if the change | 210 * to a member from an unknown type. This field will be omitted if the change |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 * Validates that the [newName] is a valid identifier and is appropriate for | 298 * Validates that the [newName] is a valid identifier and is appropriate for |
| 279 * the type of the [Element] being renamed. | 299 * the type of the [Element] being renamed. |
| 280 * | 300 * |
| 281 * It does not perform all the checks (such as checking for conflicts with any | 301 * It does not perform all the checks (such as checking for conflicts with any |
| 282 * existing names in any of the scopes containing the current name), as many | 302 * existing names in any of the scopes containing the current name), as many |
| 283 * of these checkes require search engine. Use [checkFinalConditions] for this | 303 * of these checkes require search engine. Use [checkFinalConditions] for this |
| 284 * level of checking. | 304 * level of checking. |
| 285 */ | 305 */ |
| 286 RefactoringStatus checkNewName(); | 306 RefactoringStatus checkNewName(); |
| 287 } | 307 } |
| OLD | NEW |