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 27 matching lines...) Expand all Loading... |
38 return rangeNode(executableNode); | 38 return rangeNode(executableNode); |
39 } | 39 } |
40 // not a part of a declaration with locals | 40 // not a part of a declaration with locals |
41 return SourceRange.EMPTY; | 41 return SourceRange.EMPTY; |
42 } | 42 } |
43 | 43 |
44 /** | 44 /** |
45 * Returns the source which should replace given invocation with given | 45 * Returns the source which should replace given invocation with given |
46 * arguments. | 46 * arguments. |
47 */ | 47 */ |
48 String _getMethodSourceForInvocation(RefactoringStatus status, _SourcePart part, | 48 String _getMethodSourceForInvocation( |
49 CorrectionUtils utils, AstNode contextNode, Expression targetExpression, | 49 RefactoringStatus status, |
| 50 _SourcePart part, |
| 51 CorrectionUtils utils, |
| 52 AstNode contextNode, |
| 53 Expression targetExpression, |
50 List<Expression> arguments) { | 54 List<Expression> arguments) { |
51 // prepare edits to replace parameters with arguments | 55 // prepare edits to replace parameters with arguments |
52 List<SourceEdit> edits = <SourceEdit>[]; | 56 List<SourceEdit> edits = <SourceEdit>[]; |
53 part._parameters.forEach((ParameterElement parameter, | 57 part._parameters.forEach( |
54 List<_ParameterOccurrence> occurrences) { | 58 (ParameterElement parameter, List<_ParameterOccurrence> occurrences) { |
55 // prepare argument | 59 // prepare argument |
56 Expression argument = null; | 60 Expression argument = null; |
57 for (Expression arg in arguments) { | 61 for (Expression arg in arguments) { |
58 if (arg.bestParameterElement == parameter) { | 62 if (arg.bestParameterElement == parameter) { |
59 argument = arg; | 63 argument = arg; |
60 break; | 64 break; |
61 } | 65 } |
62 } | 66 } |
63 if (argument is NamedExpression) { | 67 if (argument is NamedExpression) { |
64 argument = (argument as NamedExpression).expression; | 68 argument = (argument as NamedExpression).expression; |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 } | 813 } |
810 | 814 |
811 void _addVariable(SimpleIdentifier node) { | 815 void _addVariable(SimpleIdentifier node) { |
812 VariableElement variableElement = getLocalVariableElement(node); | 816 VariableElement variableElement = getLocalVariableElement(node); |
813 if (variableElement != null) { | 817 if (variableElement != null) { |
814 SourceRange nodeRange = rangeNode(node); | 818 SourceRange nodeRange = rangeNode(node); |
815 result.addVariable(variableElement, nodeRange); | 819 result.addVariable(variableElement, nodeRange); |
816 } | 820 } |
817 } | 821 } |
818 } | 822 } |
OLD | NEW |