| 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_class_member; | 5 library services.src.refactoring.rename_class_member; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol_server.dart' hide Element, | 9 import 'package:analysis_server/src/protocol_server.dart' hide Element, |
| 10 ElementKind; | 10 ElementKind; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (element is MethodElement && (element as MethodElement).isOperator) { | 66 if (element is MethodElement && (element as MethodElement).isOperator) { |
| 67 result.addFatalError('Cannot rename operator.'); | 67 result.addFatalError('Cannot rename operator.'); |
| 68 } | 68 } |
| 69 return new Future.value(result); | 69 return new Future.value(result); |
| 70 } | 70 } |
| 71 | 71 |
| 72 @override | 72 @override |
| 73 RefactoringStatus checkNewName() { | 73 RefactoringStatus checkNewName() { |
| 74 RefactoringStatus result = super.checkNewName(); | 74 RefactoringStatus result = super.checkNewName(); |
| 75 if (element is FieldElement) { | 75 if (element is FieldElement) { |
| 76 FieldElement fieldElement = element as FieldElement; | 76 result.addStatus(validateFieldName(newName)); |
| 77 if (fieldElement.isStatic && fieldElement.isConst) { | |
| 78 result.addStatus(validateConstantName(newName)); | |
| 79 } else { | |
| 80 result.addStatus(validateFieldName(newName)); | |
| 81 } | |
| 82 } | 77 } |
| 83 if (element is MethodElement) { | 78 if (element is MethodElement) { |
| 84 result.addStatus(validateMethodName(newName)); | 79 result.addStatus(validateMethodName(newName)); |
| 85 } | 80 } |
| 86 return result; | 81 return result; |
| 87 } | 82 } |
| 88 | 83 |
| 89 @override | 84 @override |
| 90 Future fillChange() { | 85 Future fillChange() { |
| 91 // update declarations | 86 // update declarations |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 246 } |
| 252 return _prepareElements().then((_) { | 247 return _prepareElements().then((_) { |
| 253 return Future.forEach(elements, (Element element) { | 248 return Future.forEach(elements, (Element element) { |
| 254 return searchEngine.searchReferences(element).then((references) { | 249 return searchEngine.searchReferences(element).then((references) { |
| 255 this.references.addAll(references); | 250 this.references.addAll(references); |
| 256 }); | 251 }); |
| 257 }); | 252 }); |
| 258 }); | 253 }); |
| 259 } | 254 } |
| 260 } | 255 } |
| OLD | NEW |