| 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 edit.domain; | 5 library edit.domain; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/edit/assist/assist_core.dart'; | 9 import 'package:analysis_server/edit/assist/assist_core.dart'; |
| 10 import 'package:analysis_server/edit/fix/fix_core.dart'; | 10 import 'package:analysis_server/edit/fix/fix_core.dart'; |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 585 } |
| 586 if (kind == RefactoringKind.MOVE_FILE) { | 586 if (kind == RefactoringKind.MOVE_FILE) { |
| 587 ContextSourcePair contextSource = server.getContextSourcePair(file); | 587 ContextSourcePair contextSource = server.getContextSourcePair(file); |
| 588 engine.AnalysisContext context = contextSource.context; | 588 engine.AnalysisContext context = contextSource.context; |
| 589 Source source = contextSource.source; | 589 Source source = contextSource.source; |
| 590 refactoring = new MoveFileRefactoring( | 590 refactoring = new MoveFileRefactoring( |
| 591 server.resourceProvider, searchEngine, context, source, file); | 591 server.resourceProvider, searchEngine, context, source, file); |
| 592 } | 592 } |
| 593 if (kind == RefactoringKind.RENAME) { | 593 if (kind == RefactoringKind.RENAME) { |
| 594 List<AstNode> nodes = server.getNodesAtOffset(file, offset); | 594 List<AstNode> nodes = server.getNodesAtOffset(file, offset); |
| 595 List<Element> elements = server.getElementsOfNodes(nodes, offset); | 595 List<Element> elements = server.getElementsOfNodes(nodes); |
| 596 if (nodes.isNotEmpty && elements.isNotEmpty) { | 596 if (nodes.isNotEmpty && elements.isNotEmpty) { |
| 597 AstNode node = nodes[0]; | 597 AstNode node = nodes[0]; |
| 598 Element element = elements[0]; | 598 Element element = elements[0]; |
| 599 if (element is FieldFormalParameterElement) { | 599 if (element is FieldFormalParameterElement) { |
| 600 element = (element as FieldFormalParameterElement).field; | 600 element = (element as FieldFormalParameterElement).field; |
| 601 } | 601 } |
| 602 // climb from "Class" in "new Class.named()" to "Class.named" | 602 // climb from "Class" in "new Class.named()" to "Class.named" |
| 603 if (node.parent is TypeName && node.parent.parent is ConstructorName) { | 603 if (node.parent is TypeName && node.parent.parent is ConstructorName) { |
| 604 ConstructorName constructor = node.parent.parent; | 604 ConstructorName constructor = node.parent.parent; |
| 605 node = constructor; | 605 node = constructor; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 } | 729 } |
| 730 return new RefactoringStatus(); | 730 return new RefactoringStatus(); |
| 731 } | 731 } |
| 732 } | 732 } |
| 733 | 733 |
| 734 /** | 734 /** |
| 735 * [_RefactoringManager] throws instances of this class internally to stop | 735 * [_RefactoringManager] throws instances of this class internally to stop |
| 736 * processing in a manager that was reset. | 736 * processing in a manager that was reset. |
| 737 */ | 737 */ |
| 738 class _ResetError {} | 738 class _ResetError {} |
| OLD | NEW |