| 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_local; | 5 library services.src.refactoring.rename_local; |
| 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 import 'package:analysis_server/src/services/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 for (Source librarySource in librarySources) { | 49 for (Source librarySource in librarySources) { |
| 50 _analyzePossibleConflicts_inLibrary(result, unitSource, librarySource); | 50 _analyzePossibleConflicts_inLibrary(result, unitSource, librarySource); |
| 51 } | 51 } |
| 52 return new Future.value(result); | 52 return new Future.value(result); |
| 53 } | 53 } |
| 54 | 54 |
| 55 @override | 55 @override |
| 56 RefactoringStatus checkNewName() { | 56 RefactoringStatus checkNewName() { |
| 57 RefactoringStatus result = super.checkNewName(); | 57 RefactoringStatus result = super.checkNewName(); |
| 58 if (element is LocalVariableElement) { | 58 if (element is LocalVariableElement) { |
| 59 LocalVariableElement variableElement = element; | 59 result.addStatus(validateVariableName(newName)); |
| 60 if (variableElement.isConst) { | |
| 61 result.addStatus(validateConstantName(newName)); | |
| 62 } else { | |
| 63 result.addStatus(validateVariableName(newName)); | |
| 64 } | |
| 65 } else if (element is ParameterElement) { | 60 } else if (element is ParameterElement) { |
| 66 result.addStatus(validateParameterName(newName)); | 61 result.addStatus(validateParameterName(newName)); |
| 67 } else if (element is FunctionElement) { | 62 } else if (element is FunctionElement) { |
| 68 result.addStatus(validateFunctionName(newName)); | 63 result.addStatus(validateFunctionName(newName)); |
| 69 } | 64 } |
| 70 return result; | 65 return result; |
| 71 } | 66 } |
| 72 | 67 |
| 73 @override | 68 @override |
| 74 Future fillChange() { | 69 Future fillChange() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 '"$nameElementSourceName" will be shadowed by renamed $refKind.'
; | 128 '"$nameElementSourceName" will be shadowed by renamed $refKind.'
; |
| 134 result.addError(message, newLocation_fromNode(node)); | 129 result.addError(message, newLocation_fromNode(node)); |
| 135 } | 130 } |
| 136 } | 131 } |
| 137 } | 132 } |
| 138 | 133 |
| 139 static bool _isNamedExpressionName(SimpleIdentifier node) { | 134 static bool _isNamedExpressionName(SimpleIdentifier node) { |
| 140 return node.parent is Label && node.parent.parent is NamedExpression; | 135 return node.parent is Label && node.parent.parent is NamedExpression; |
| 141 } | 136 } |
| 142 } | 137 } |
| OLD | NEW |