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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 RefactoringStatus _prepareMethod() { | 317 RefactoringStatus _prepareMethod() { |
318 _methodElement = null; | 318 _methodElement = null; |
319 _methodParameters = null; | 319 _methodParameters = null; |
320 _methodBody = null; | 320 _methodBody = null; |
321 deleteSource = false; | 321 deleteSource = false; |
322 inlineAll = false; | 322 inlineAll = false; |
323 // prepare for failure | 323 // prepare for failure |
324 RefactoringStatus fatalStatus = new RefactoringStatus.fatal( | 324 RefactoringStatus fatalStatus = new RefactoringStatus.fatal( |
325 'Method declaration or reference must be selected to activate this refac
toring.'); | 325 'Method declaration or reference must be selected to activate this refac
toring.'); |
326 // prepare selected SimpleIdentifier | 326 // prepare selected SimpleIdentifier |
327 AstNode node = new NodeLocator.con1(offset).searchWithin(unit); | 327 AstNode node = new NodeLocator(offset).searchWithin(unit); |
328 if (node is! SimpleIdentifier) { | 328 if (node is! SimpleIdentifier) { |
329 return fatalStatus; | 329 return fatalStatus; |
330 } | 330 } |
331 SimpleIdentifier identifier = node as SimpleIdentifier; | 331 SimpleIdentifier identifier = node as SimpleIdentifier; |
332 // prepare selected ExecutableElement | 332 // prepare selected ExecutableElement |
333 Element element = identifier.bestElement; | 333 Element element = identifier.bestElement; |
334 if (element is! ExecutableElement) { | 334 if (element is! ExecutableElement) { |
335 return fatalStatus; | 335 return fatalStatus; |
336 } | 336 } |
337 if (element.isSynthetic) { | 337 if (element.isSynthetic) { |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 } | 809 } |
810 | 810 |
811 void _addVariable(SimpleIdentifier node) { | 811 void _addVariable(SimpleIdentifier node) { |
812 VariableElement variableElement = getLocalVariableElement(node); | 812 VariableElement variableElement = getLocalVariableElement(node); |
813 if (variableElement != null) { | 813 if (variableElement != null) { |
814 SourceRange nodeRange = rangeNode(node); | 814 SourceRange nodeRange = rangeNode(node); |
815 result.addVariable(variableElement, nodeRange); | 815 result.addVariable(variableElement, nodeRange); |
816 } | 816 } |
817 } | 817 } |
818 } | 818 } |
OLD | NEW |