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.refactoring; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import 'package:analysis_server/protocol/protocol_generated.dart' | |
10 show RefactoringMethodParameter, SourceChange; | |
11 import 'package:analysis_server/src/services/correction/status.dart'; | 7 import 'package:analysis_server/src/services/correction/status.dart'; |
12 import 'package:analysis_server/src/services/refactoring/convert_getter_to_metho
d.dart'; | 8 import 'package:analysis_server/src/services/refactoring/convert_getter_to_metho
d.dart'; |
13 import 'package:analysis_server/src/services/refactoring/convert_method_to_gette
r.dart'; | 9 import 'package:analysis_server/src/services/refactoring/convert_method_to_gette
r.dart'; |
14 import 'package:analysis_server/src/services/refactoring/extract_local.dart'; | 10 import 'package:analysis_server/src/services/refactoring/extract_local.dart'; |
15 import 'package:analysis_server/src/services/refactoring/extract_method.dart'; | 11 import 'package:analysis_server/src/services/refactoring/extract_method.dart'; |
16 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; | 12 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; |
17 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; | 13 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; |
18 import 'package:analysis_server/src/services/refactoring/move_file.dart'; | 14 import 'package:analysis_server/src/services/refactoring/move_file.dart'; |
19 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar
t'; | 15 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar
t'; |
20 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart
'; | 16 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart
'; |
21 import 'package:analysis_server/src/services/refactoring/rename_import.dart'; | 17 import 'package:analysis_server/src/services/refactoring/rename_import.dart'; |
22 import 'package:analysis_server/src/services/refactoring/rename_label.dart'; | 18 import 'package:analysis_server/src/services/refactoring/rename_label.dart'; |
23 import 'package:analysis_server/src/services/refactoring/rename_library.dart'; | 19 import 'package:analysis_server/src/services/refactoring/rename_library.dart'; |
24 import 'package:analysis_server/src/services/refactoring/rename_local.dart'; | 20 import 'package:analysis_server/src/services/refactoring/rename_local.dart'; |
25 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
'; | 21 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
'; |
26 import 'package:analysis_server/src/services/search/search_engine.dart'; | 22 import 'package:analysis_server/src/services/search/search_engine.dart'; |
27 import 'package:analyzer/dart/ast/ast.dart'; | 23 import 'package:analyzer/dart/ast/ast.dart'; |
28 import 'package:analyzer/dart/element/element.dart'; | 24 import 'package:analyzer/dart/element/element.dart'; |
29 import 'package:analyzer/file_system/file_system.dart'; | 25 import 'package:analyzer/file_system/file_system.dart'; |
30 import 'package:analyzer/src/dart/element/ast_provider.dart'; | 26 import 'package:analyzer/src/dart/element/ast_provider.dart'; |
31 import 'package:analyzer/src/generated/engine.dart'; | 27 import 'package:analyzer/src/generated/engine.dart'; |
32 import 'package:analyzer/src/generated/source.dart'; | 28 import 'package:analyzer/src/generated/source.dart'; |
| 29 import 'package:analyzer_plugin/protocol/protocol_common.dart' |
| 30 show RefactoringMethodParameter, SourceChange; |
33 | 31 |
34 /** | 32 /** |
35 * [Refactoring] to convert getters into normal [MethodDeclaration]s. | 33 * [Refactoring] to convert getters into normal [MethodDeclaration]s. |
36 */ | 34 */ |
37 abstract class ConvertGetterToMethodRefactoring implements Refactoring { | 35 abstract class ConvertGetterToMethodRefactoring implements Refactoring { |
38 /** | 36 /** |
39 * Returns a new [ConvertMethodToGetterRefactoring] instance for converting | 37 * Returns a new [ConvertMethodToGetterRefactoring] instance for converting |
40 * [element] and all the corresponding hierarchy elements. | 38 * [element] and all the corresponding hierarchy elements. |
41 */ | 39 */ |
42 factory ConvertGetterToMethodRefactoring(SearchEngine searchEngine, | 40 factory ConvertGetterToMethodRefactoring(SearchEngine searchEngine, |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 element.getAncestor((e) => e is CompilationUnitElement) | 453 element.getAncestor((e) => e is CompilationUnitElement) |
456 as CompilationUnitElement; | 454 as CompilationUnitElement; |
457 CompilationUnit unit = _map[unitElement]; | 455 CompilationUnit unit = _map[unitElement]; |
458 if (unit == null) { | 456 if (unit == null) { |
459 unit = await _astProvider.getResolvedUnitForElement(element); | 457 unit = await _astProvider.getResolvedUnitForElement(element); |
460 _map[unitElement] = unit; | 458 _map[unitElement] = unit; |
461 } | 459 } |
462 return unit; | 460 return unit; |
463 } | 461 } |
464 } | 462 } |
OLD | NEW |