| 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/inline_local.dart'; |
| 15 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; | 15 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; |
| 16 import 'package:analysis_server/src/services/refactoring/move_file.dart'; |
| 16 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar
t'; | 17 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar
t'; |
| 17 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart
'; | 18 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart
'; |
| 18 import 'package:analysis_server/src/services/refactoring/rename_import.dart'; | 19 import 'package:analysis_server/src/services/refactoring/rename_import.dart'; |
| 19 import 'package:analysis_server/src/services/refactoring/rename_label.dart'; | 20 import 'package:analysis_server/src/services/refactoring/rename_label.dart'; |
| 20 import 'package:analysis_server/src/services/refactoring/rename_library.dart'; | 21 import 'package:analysis_server/src/services/refactoring/rename_library.dart'; |
| 21 import 'package:analysis_server/src/services/refactoring/rename_local.dart'; | 22 import 'package:analysis_server/src/services/refactoring/rename_local.dart'; |
| 22 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
'; | 23 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
'; |
| 23 import 'package:analysis_server/src/services/search/search_engine.dart'; | 24 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 24 import 'package:analyzer/src/generated/ast.dart'; | 25 import 'package:analyzer/src/generated/ast.dart'; |
| 25 import 'package:analyzer/src/generated/element.dart'; | 26 import 'package:analyzer/src/generated/element.dart'; |
| 27 import 'package:analyzer/src/generated/engine.dart'; |
| 28 import 'package:analyzer/src/generated/source.dart'; |
| 26 | 29 |
| 27 | 30 |
| 28 /** | 31 /** |
| 29 * [Refactoring] to extract an expression into a local variable declaration. | 32 * [Refactoring] to extract an expression into a local variable declaration. |
| 30 */ | 33 */ |
| 31 abstract class ExtractLocalRefactoring implements Refactoring { | 34 abstract class ExtractLocalRefactoring implements Refactoring { |
| 32 /** | 35 /** |
| 33 * Returns a new [ExtractLocalRefactoring] instance. | 36 * Returns a new [ExtractLocalRefactoring] instance. |
| 34 */ | 37 */ |
| 35 factory ExtractLocalRefactoring(CompilationUnit unit, int selectionOffset, | 38 factory ExtractLocalRefactoring(CompilationUnit unit, int selectionOffset, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 bool get isDeclaration; | 244 bool get isDeclaration; |
| 242 | 245 |
| 243 /** | 246 /** |
| 244 * The name of the method (or function) being inlined. | 247 * The name of the method (or function) being inlined. |
| 245 */ | 248 */ |
| 246 String get methodName; | 249 String get methodName; |
| 247 } | 250 } |
| 248 | 251 |
| 249 | 252 |
| 250 /** | 253 /** |
| 254 * [Refactoring] to move/rename a file. |
| 255 */ |
| 256 abstract class MoveFileRefactoring implements Refactoring { |
| 257 /** |
| 258 * Returns a new [MoveFileRefactoring] instance. |
| 259 */ |
| 260 factory MoveFileRefactoring(SearchEngine searchEngine, |
| 261 AnalysisContext context, Source source) { |
| 262 return new MoveFileRefactoringImpl(searchEngine, context, source); |
| 263 } |
| 264 |
| 265 /** |
| 266 * The new file path to which the given file is being moved. |
| 267 */ |
| 268 void set newFile(String newName); |
| 269 } |
| 270 |
| 271 |
| 272 /** |
| 251 * Abstract interface for all refactorings. | 273 * Abstract interface for all refactorings. |
| 252 */ | 274 */ |
| 253 abstract class Refactoring { | 275 abstract class Refactoring { |
| 254 /** | 276 /** |
| 255 * The ids of source edits that are not known to be valid. | 277 * The ids of source edits that are not known to be valid. |
| 256 * | 278 * |
| 257 * An edit is not known to be valid if there was insufficient type information | 279 * An edit is not known to be valid if there was insufficient type information |
| 258 * for the server to be able to determine whether or not the code needs to be | 280 * for the server to be able to determine whether or not the code needs to be |
| 259 * modified, such as when a member is being renamed and there is a reference | 281 * modified, such as when a member is being renamed and there is a reference |
| 260 * to a member from an unknown type. This field will be omitted if the change | 282 * to a member from an unknown type. This field will be omitted if the change |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 * Validates that the [newName] is a valid identifier and is appropriate for | 379 * Validates that the [newName] is a valid identifier and is appropriate for |
| 358 * the type of the [Element] being renamed. | 380 * the type of the [Element] being renamed. |
| 359 * | 381 * |
| 360 * It does not perform all the checks (such as checking for conflicts with any | 382 * It does not perform all the checks (such as checking for conflicts with any |
| 361 * existing names in any of the scopes containing the current name), as many | 383 * existing names in any of the scopes containing the current name), as many |
| 362 * of these checkes require search engine. Use [checkFinalConditions] for this | 384 * of these checkes require search engine. Use [checkFinalConditions] for this |
| 363 * level of checking. | 385 * level of checking. |
| 364 */ | 386 */ |
| 365 RefactoringStatus checkNewName(); | 387 RefactoringStatus checkNewName(); |
| 366 } | 388 } |
| OLD | NEW |