| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // done | 273 // done |
| 274 return new Future.value(result); | 274 return new Future.value(result); |
| 275 } | 275 } |
| 276 | 276 |
| 277 @override | 277 @override |
| 278 Future<RefactoringStatus> checkInitialConditions() async { | 278 Future<RefactoringStatus> checkInitialConditions() async { |
| 279 RefactoringStatus result = new RefactoringStatus(); | 279 RefactoringStatus result = new RefactoringStatus(); |
| 280 // prepare method information | 280 // prepare method information |
| 281 result.addStatus(_prepareMethod()); | 281 result.addStatus(_prepareMethod()); |
| 282 if (result.hasFatalError) { | 282 if (result.hasFatalError) { |
| 283 return new Future.value(result); | 283 return new Future<RefactoringStatus>.value(result); |
| 284 } | 284 } |
| 285 // maybe operator | 285 // maybe operator |
| 286 if (_methodElement.isOperator) { | 286 if (_methodElement.isOperator) { |
| 287 result = new RefactoringStatus.fatal('Cannot inline operator.'); | 287 result = new RefactoringStatus.fatal('Cannot inline operator.'); |
| 288 return new Future.value(result); | 288 return new Future<RefactoringStatus>.value(result); |
| 289 } | 289 } |
| 290 // analyze method body | 290 // analyze method body |
| 291 result.addStatus(_prepareMethodParts()); | 291 result.addStatus(_prepareMethodParts()); |
| 292 // process references | 292 // process references |
| 293 List<SearchMatch> references = | 293 List<SearchMatch> references = |
| 294 await searchEngine.searchReferences(_methodElement); | 294 await searchEngine.searchReferences(_methodElement); |
| 295 _referenceProcessors.clear(); | 295 _referenceProcessors.clear(); |
| 296 for (SearchMatch reference in references) { | 296 for (SearchMatch reference in references) { |
| 297 _ReferenceProcessor processor = new _ReferenceProcessor(this, reference); | 297 _ReferenceProcessor processor = new _ReferenceProcessor(this, reference); |
| 298 _referenceProcessors.add(processor); | 298 _referenceProcessors.add(processor); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 } | 825 } |
| 826 | 826 |
| 827 void _addVariable(SimpleIdentifier node) { | 827 void _addVariable(SimpleIdentifier node) { |
| 828 VariableElement variableElement = getLocalVariableElement(node); | 828 VariableElement variableElement = getLocalVariableElement(node); |
| 829 if (variableElement != null) { | 829 if (variableElement != null) { |
| 830 SourceRange nodeRange = rangeNode(node); | 830 SourceRange nodeRange = rangeNode(node); |
| 831 result.addVariable(variableElement, nodeRange); | 831 result.addVariable(variableElement, nodeRange); |
| 832 } | 832 } |
| 833 } | 833 } |
| 834 } | 834 } |
| OLD | NEW |