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.inline_method; | 5 library services.src.refactoring.inline_method; |
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/source_range.dart'; | 10 import 'package:analysis_server/src/services/correction/source_range.dart'; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 result.add(classMemberElement.displayName); | 184 result.add(classMemberElement.displayName); |
185 } | 185 } |
186 } | 186 } |
187 } | 187 } |
188 } | 188 } |
189 // done | 189 // done |
190 return result; | 190 return result; |
191 } | 191 } |
192 | 192 |
193 /** | 193 /** |
194 * Completes with the resolved [CompilationUnit] that contains the [element]. | |
195 */ | |
196 typedef Future<CompilationUnit> GetResolvedUnitContainingElement( | |
197 Element element); | |
198 | |
199 /** | |
200 * [InlineMethodRefactoring] implementation. | 194 * [InlineMethodRefactoring] implementation. |
201 */ | 195 */ |
202 class InlineMethodRefactoringImpl extends RefactoringImpl | 196 class InlineMethodRefactoringImpl extends RefactoringImpl |
203 implements InlineMethodRefactoring { | 197 implements InlineMethodRefactoring { |
204 final SearchEngine searchEngine; | 198 final SearchEngine searchEngine; |
205 final GetResolvedUnitContainingElement getResolvedUnit; | 199 final GetResolvedUnit getResolvedUnit; |
206 final CompilationUnit unit; | 200 final CompilationUnit unit; |
207 final int offset; | 201 final int offset; |
208 CorrectionUtils utils; | 202 CorrectionUtils utils; |
209 SourceChange change; | 203 SourceChange change; |
210 | 204 |
211 bool isDeclaration = false; | 205 bool isDeclaration = false; |
212 bool deleteSource = false; | 206 bool deleteSource = false; |
213 bool inlineAll = true; | 207 bool inlineAll = true; |
214 | 208 |
215 ExecutableElement _methodElement; | 209 ExecutableElement _methodElement; |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 } | 864 } |
871 | 865 |
872 void _addVariable(SimpleIdentifier node) { | 866 void _addVariable(SimpleIdentifier node) { |
873 VariableElement variableElement = getLocalVariableElement(node); | 867 VariableElement variableElement = getLocalVariableElement(node); |
874 if (variableElement != null) { | 868 if (variableElement != null) { |
875 SourceRange nodeRange = rangeNode(node); | 869 SourceRange nodeRange = rangeNode(node); |
876 result.addVariable(variableElement, nodeRange); | 870 result.addVariable(variableElement, nodeRange); |
877 } | 871 } |
878 } | 872 } |
879 } | 873 } |
OLD | NEW |