| 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_services/correction/change.dart'; | 9 import 'package:analysis_services/correction/change.dart'; |
| 10 import 'package:analysis_services/correction/status.dart'; | 10 import 'package:analysis_services/correction/status.dart'; |
| 11 import 'package:analysis_services/search/search_engine.dart'; | 11 import 'package:analysis_services/search/search_engine.dart'; |
| 12 import 'package:analysis_services/src/refactoring/rename_constructor.dart'; |
| 12 import 'package:analysis_services/src/refactoring/rename_import.dart'; | 13 import 'package:analysis_services/src/refactoring/rename_import.dart'; |
| 13 import 'package:analysis_services/src/refactoring/rename_library.dart'; | 14 import 'package:analysis_services/src/refactoring/rename_library.dart'; |
| 14 import 'package:analysis_services/src/refactoring/rename_local.dart'; | 15 import 'package:analysis_services/src/refactoring/rename_local.dart'; |
| 15 import 'package:analyzer/src/generated/element.dart'; | 16 import 'package:analyzer/src/generated/element.dart'; |
| 16 | 17 |
| 17 | 18 |
| 18 /** | 19 /** |
| 19 * Abstract interface for all refactorings. | 20 * Abstract interface for all refactorings. |
| 20 */ | 21 */ |
| 21 abstract class Refactoring { | 22 abstract class Refactoring { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 /** | 61 /** |
| 61 * Abstract [Refactoring] for renaming some [Element]. | 62 * Abstract [Refactoring] for renaming some [Element]. |
| 62 */ | 63 */ |
| 63 abstract class RenameRefactoring implements Refactoring { | 64 abstract class RenameRefactoring implements Refactoring { |
| 64 /** | 65 /** |
| 65 * Returns a new [RenameRefactoring] instance for renaming [element], | 66 * Returns a new [RenameRefactoring] instance for renaming [element], |
| 66 * maybe `null` if there is no support for renaming [Element]s of the given | 67 * maybe `null` if there is no support for renaming [Element]s of the given |
| 67 * type. | 68 * type. |
| 68 */ | 69 */ |
| 69 factory RenameRefactoring(SearchEngine searchEngine, Element element) { | 70 factory RenameRefactoring(SearchEngine searchEngine, Element element) { |
| 71 if (element is ConstructorElement) { |
| 72 return new RenameConstructorRefactoringImpl(searchEngine, element); |
| 73 } |
| 70 if (element is ImportElement) { | 74 if (element is ImportElement) { |
| 71 return new RenameImportRefactoringImpl(searchEngine, element); | 75 return new RenameImportRefactoringImpl(searchEngine, element); |
| 72 } | 76 } |
| 73 if (element is LibraryElement) { | 77 if (element is LibraryElement) { |
| 74 return new RenameLibraryRefactoringImpl(searchEngine, element); | 78 return new RenameLibraryRefactoringImpl(searchEngine, element); |
| 75 } | 79 } |
| 76 if (element is LocalElement) { | 80 if (element is LocalElement) { |
| 77 return new RenameLocalRefactoringImpl(searchEngine, element); | 81 return new RenameLocalRefactoringImpl(searchEngine, element); |
| 78 } | 82 } |
| 79 return null; | 83 return null; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 93 * Validates that the [newName] is a valid identifier and is appropriate for | 97 * Validates that the [newName] is a valid identifier and is appropriate for |
| 94 * the type of the [Element] being renamed. | 98 * the type of the [Element] being renamed. |
| 95 * | 99 * |
| 96 * It does not perform all the checks (such as checking for conflicts with any | 100 * It does not perform all the checks (such as checking for conflicts with any |
| 97 * existing names in any of the scopes containing the current name), as many | 101 * existing names in any of the scopes containing the current name), as many |
| 98 * of these checkes require search engine. Use [checkFinalConditions] for this | 102 * of these checkes require search engine. Use [checkFinalConditions] for this |
| 99 * level of checking. | 103 * level of checking. |
| 100 */ | 104 */ |
| 101 RefactoringStatus checkNewName(); | 105 RefactoringStatus checkNewName(); |
| 102 } | 106 } |
| OLD | NEW |