| 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' show | 9 import 'package:analysis_server/src/protocol_server.dart' show |
| 10 newLocation_fromElement, newLocation_fromMatch; | 10 newLocation_fromElement, newLocation_fromMatch; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 @override | 70 @override |
| 71 Future<RefactoringStatus> checkFinalConditions() { | 71 Future<RefactoringStatus> checkFinalConditions() { |
| 72 return validateRenameTopLevel(searchEngine, element, newName); | 72 return validateRenameTopLevel(searchEngine, element, newName); |
| 73 } | 73 } |
| 74 | 74 |
| 75 @override | 75 @override |
| 76 RefactoringStatus checkNewName() { | 76 RefactoringStatus checkNewName() { |
| 77 RefactoringStatus result = super.checkNewName(); | 77 RefactoringStatus result = super.checkNewName(); |
| 78 if (element is TopLevelVariableElement) { | 78 if (element is TopLevelVariableElement) { |
| 79 TopLevelVariableElement variable = element as TopLevelVariableElement; | 79 result.addStatus(validateVariableName(newName)); |
| 80 if (variable.isConst) { | |
| 81 result.addStatus(validateConstantName(newName)); | |
| 82 } else { | |
| 83 result.addStatus(validateVariableName(newName)); | |
| 84 } | |
| 85 } | 80 } |
| 86 if (element is FunctionElement) { | 81 if (element is FunctionElement) { |
| 87 result.addStatus(validateFunctionName(newName)); | 82 result.addStatus(validateFunctionName(newName)); |
| 88 } | 83 } |
| 89 if (element is FunctionTypeAliasElement) { | 84 if (element is FunctionTypeAliasElement) { |
| 90 result.addStatus(validateFunctionTypeAliasName(newName)); | 85 result.addStatus(validateFunctionTypeAliasName(newName)); |
| 91 } | 86 } |
| 92 if (element is ClassElement) { | 87 if (element is ClassElement) { |
| 93 result.addStatus(validateClassName(newName)); | 88 result.addStatus(validateClassName(newName)); |
| 94 } | 89 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 elementKind.displayName, | 253 elementKind.displayName, |
| 259 getElementKindName(member), | 254 getElementKindName(member), |
| 260 getElementQualifiedName(member)); | 255 getElementQualifiedName(member)); |
| 261 result.addError(message, newLocation_fromMatch(memberReference)); | 256 result.addError(message, newLocation_fromMatch(memberReference)); |
| 262 } | 257 } |
| 263 }); | 258 }); |
| 264 }); | 259 }); |
| 265 }); | 260 }); |
| 266 } | 261 } |
| 267 } | 262 } |
| OLD | NEW |