| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol_server.dart' hide Element; | 7 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| 8 import 'package:analysis_server/src/services/correction/status.dart'; | 8 import 'package:analysis_server/src/services/correction/status.dart'; |
| 9 import 'package:analysis_server/src/services/correction/util.dart'; | 9 import 'package:analysis_server/src/services/correction/util.dart'; |
| 10 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart
'; | 10 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart
'; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 SourceReference _createDeclarationReference() { | 94 SourceReference _createDeclarationReference() { |
| 95 SourceRange sourceRange; | 95 SourceRange sourceRange; |
| 96 int offset = element.periodOffset; | 96 int offset = element.periodOffset; |
| 97 if (offset != null) { | 97 if (offset != null) { |
| 98 sourceRange = range.startOffsetEndOffset(offset, element.nameEnd); | 98 sourceRange = range.startOffsetEndOffset(offset, element.nameEnd); |
| 99 } else { | 99 } else { |
| 100 sourceRange = new SourceRange(element.nameEnd, 0); | 100 sourceRange = new SourceRange(element.nameEnd, 0); |
| 101 } | 101 } |
| 102 return new SourceReference(new SearchMatchImpl( | 102 return new SourceReference(new SearchMatchImpl( |
| 103 element.context, | 103 element.source.fullName, |
| 104 element.library.source.uri.toString(), | 104 element.library.source, |
| 105 element.source.uri.toString(), | 105 element.source, |
| 106 element.library, |
| 107 element, |
| 108 true, |
| 109 true, |
| 106 MatchKind.DECLARATION, | 110 MatchKind.DECLARATION, |
| 107 sourceRange, | 111 sourceRange)); |
| 108 true, | |
| 109 true)); | |
| 110 } | 112 } |
| 111 | 113 |
| 112 Future<Null> _replaceSynthetic() async { | 114 Future<Null> _replaceSynthetic() async { |
| 113 ClassElement classElement = element.enclosingElement; | 115 ClassElement classElement = element.enclosingElement; |
| 114 AstNode name = await astProvider.getResolvedNameForElement(classElement); | 116 AstNode name = await astProvider.getResolvedNameForElement(classElement); |
| 115 ClassDeclaration classNode = name.parent as ClassDeclaration; | 117 ClassDeclaration classNode = name.parent as ClassDeclaration; |
| 116 CorrectionUtils utils = new CorrectionUtils(classNode.parent); | 118 CorrectionUtils utils = new CorrectionUtils(classNode.parent); |
| 117 ClassMemberLocation location = | 119 ClassMemberLocation location = |
| 118 utils.prepareNewConstructorLocation(classNode); | 120 utils.prepareNewConstructorLocation(classNode); |
| 119 doSourceChange_addElementEdit( | 121 doSourceChange_addElementEdit( |
| 120 change, | 122 change, |
| 121 classElement, | 123 classElement, |
| 122 new SourceEdit( | 124 new SourceEdit( |
| 123 location.offset, | 125 location.offset, |
| 124 0, | 126 0, |
| 125 location.prefix + | 127 location.prefix + |
| 126 '${classElement.name}.$newName();' + | 128 '${classElement.name}.$newName();' + |
| 127 location.suffix)); | 129 location.suffix)); |
| 128 } | 130 } |
| 129 } | 131 } |
| OLD | NEW |