| 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_unit_member; | 5 library services.src.refactoring.rename_unit_member; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol_server.dart' | 9 import 'package:analysis_server/src/protocol_server.dart' |
| 10 show newLocation_fromElement, newLocation_fromMatch; | 10 show newLocation_fromElement, newLocation_fromMatch; |
| 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/correction/util.dart'; | 12 import 'package:analysis_server/src/services/correction/util.dart'; |
| 13 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart
'; | 13 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart
'; |
| 14 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 14 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 15 import 'package:analysis_server/src/services/refactoring/rename.dart'; | 15 import 'package:analysis_server/src/services/refactoring/rename.dart'; |
| 16 import 'package:analysis_server/src/services/search/element_visitors.dart'; | 16 import 'package:analysis_server/src/services/search/element_visitors.dart'; |
| 17 import 'package:analysis_server/src/services/search/search_engine.dart'; | 17 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 18 import 'package:analyzer/dart/element/element.dart'; |
| 18 import 'package:analyzer/src/generated/ast.dart' show Identifier; | 19 import 'package:analyzer/src/generated/ast.dart' show Identifier; |
| 19 import 'package:analyzer/src/generated/element.dart'; | |
| 20 import 'package:analyzer/src/generated/java_core.dart'; | 20 import 'package:analyzer/src/generated/java_core.dart'; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Checks if creating a top-level function with the given [name] in [library] | 23 * Checks if creating a top-level function with the given [name] in [library] |
| 24 * will cause any conflicts. | 24 * will cause any conflicts. |
| 25 */ | 25 */ |
| 26 Future<RefactoringStatus> validateCreateFunction( | 26 Future<RefactoringStatus> validateCreateFunction( |
| 27 SearchEngine searchEngine, LibraryElement library, String name) { | 27 SearchEngine searchEngine, LibraryElement library, String name) { |
| 28 return new _RenameUnitMemberValidator.forCreate( | 28 return new _RenameUnitMemberValidator.forCreate( |
| 29 searchEngine, library, ElementKind.FUNCTION, name).validate(); | 29 searchEngine, library, ElementKind.FUNCTION, name) |
| 30 .validate(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 /** | 33 /** |
| 33 * Checks if creating a top-level function with the given [name] in [element] | 34 * Checks if creating a top-level function with the given [name] in [element] |
| 34 * will cause any conflicts. | 35 * will cause any conflicts. |
| 35 */ | 36 */ |
| 36 Future<RefactoringStatus> validateRenameTopLevel( | 37 Future<RefactoringStatus> validateRenameTopLevel( |
| 37 SearchEngine searchEngine, Element element, String name) { | 38 SearchEngine searchEngine, Element element, String name) { |
| 38 return new _RenameUnitMemberValidator.forRename(searchEngine, element, name) | 39 return new _RenameUnitMemberValidator.forRename(searchEngine, element, name) |
| 39 .validate(); | 40 .validate(); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 ? "Renamed {0} will shadow {1} '{2}'." | 256 ? "Renamed {0} will shadow {1} '{2}'." |
| 256 : "Created {0} will shadow {1} '{2}'.", | 257 : "Created {0} will shadow {1} '{2}'.", |
| 257 elementKind.displayName, | 258 elementKind.displayName, |
| 258 getElementKindName(member), | 259 getElementKindName(member), |
| 259 getElementQualifiedName(member)); | 260 getElementQualifiedName(member)); |
| 260 result.addError(message, newLocation_fromMatch(memberReference)); | 261 result.addError(message, newLocation_fromMatch(memberReference)); |
| 261 } | 262 } |
| 262 } | 263 } |
| 263 } | 264 } |
| 264 } | 265 } |
| OLD | NEW |