| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 final int offset; | 193 final int offset; |
| 194 CorrectionUtils utils; | 194 CorrectionUtils utils; |
| 195 SourceChange change; | 195 SourceChange change; |
| 196 | 196 |
| 197 bool isDeclaration = false; | 197 bool isDeclaration = false; |
| 198 bool deleteSource = false; | 198 bool deleteSource = false; |
| 199 bool inlineAll = true; | 199 bool inlineAll = true; |
| 200 | 200 |
| 201 ExecutableElement _methodElement; | 201 ExecutableElement _methodElement; |
| 202 bool _isAccessor; | 202 bool _isAccessor; |
| 203 String _methodFile; | |
| 204 CompilationUnit _methodUnit; | 203 CompilationUnit _methodUnit; |
| 205 CorrectionUtils _methodUtils; | 204 CorrectionUtils _methodUtils; |
| 206 AstNode _methodNode; | 205 AstNode _methodNode; |
| 207 FormalParameterList _methodParameters; | 206 FormalParameterList _methodParameters; |
| 208 FunctionBody _methodBody; | 207 FunctionBody _methodBody; |
| 209 Expression _methodExpression; | 208 Expression _methodExpression; |
| 210 _SourcePart _methodExpressionPart; | 209 _SourcePart _methodExpressionPart; |
| 211 _SourcePart _methodStatementsPart; | 210 _SourcePart _methodStatementsPart; |
| 212 List<_ReferenceProcessor> _referenceProcessors = []; | 211 List<_ReferenceProcessor> _referenceProcessors = []; |
| 213 | 212 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 return fatalStatus; | 332 return fatalStatus; |
| 334 } | 333 } |
| 335 SimpleIdentifier identifier = node as SimpleIdentifier; | 334 SimpleIdentifier identifier = node as SimpleIdentifier; |
| 336 // prepare selected ExecutableElement | 335 // prepare selected ExecutableElement |
| 337 Element element = identifier.bestElement; | 336 Element element = identifier.bestElement; |
| 338 if (element is! ExecutableElement) { | 337 if (element is! ExecutableElement) { |
| 339 return fatalStatus; | 338 return fatalStatus; |
| 340 } | 339 } |
| 341 _methodElement = element as ExecutableElement; | 340 _methodElement = element as ExecutableElement; |
| 342 _isAccessor = element is PropertyAccessorElement; | 341 _isAccessor = element is PropertyAccessorElement; |
| 343 _methodFile = _methodElement.source.fullName; | |
| 344 _methodUnit = element.unit; | 342 _methodUnit = element.unit; |
| 345 _methodUtils = new CorrectionUtils(_methodUnit); | 343 _methodUtils = new CorrectionUtils(_methodUnit); |
| 346 // class member | 344 // class member |
| 347 bool isClassMember = element.enclosingElement is ClassElement; | 345 bool isClassMember = element.enclosingElement is ClassElement; |
| 348 if (element is MethodElement || _isAccessor && isClassMember) { | 346 if (element is MethodElement || _isAccessor && isClassMember) { |
| 349 MethodDeclaration methodDeclaration = element.node; | 347 MethodDeclaration methodDeclaration = element.node; |
| 350 _methodNode = methodDeclaration; | 348 _methodNode = methodDeclaration; |
| 351 _methodParameters = methodDeclaration.parameters; | 349 _methodParameters = methodDeclaration.parameters; |
| 352 _methodBody = methodDeclaration.body; | 350 _methodBody = methodDeclaration.body; |
| 353 // prepare mode | 351 // prepare mode |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 } | 824 } |
| 827 | 825 |
| 828 void _addVariable(SimpleIdentifier node) { | 826 void _addVariable(SimpleIdentifier node) { |
| 829 VariableElement variableElement = getLocalVariableElement(node); | 827 VariableElement variableElement = getLocalVariableElement(node); |
| 830 if (variableElement != null) { | 828 if (variableElement != null) { |
| 831 SourceRange nodeRange = rangeNode(node); | 829 SourceRange nodeRange = rangeNode(node); |
| 832 result.addVariable(variableElement, nodeRange); | 830 result.addVariable(variableElement, nodeRange); |
| 833 } | 831 } |
| 834 } | 832 } |
| 835 } | 833 } |
| OLD | NEW |