Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: pkg/analysis_server/lib/src/services/refactoring/refactoring.dart

Issue 594503005: 'Convert Getter to Method' refactoring implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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; 5 library services.refactoring;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart' show 9 import 'package:analysis_server/src/protocol.dart' show
10 RefactoringMethodParameter, SourceChange; 10 RefactoringMethodParameter, SourceChange;
11 import 'package:analysis_server/src/services/correction/status.dart'; 11 import 'package:analysis_server/src/services/correction/status.dart';
12 import 'package:analysis_server/src/services/refactoring/convert_method_to_gette r.dart'; 12 import 'package:analysis_server/src/services/refactoring/convert_method_to_gette r.dart';
13 import 'package:analysis_server/src/services/refactoring/extract_local.dart'; 13 import 'package:analysis_server/src/services/refactoring/extract_local.dart';
14 import 'package:analysis_server/src/services/refactoring/extract_method.dart'; 14 import 'package:analysis_server/src/services/refactoring/extract_method.dart';
15 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; 15 import 'package:analysis_server/src/services/refactoring/inline_local.dart';
16 import 'package:analysis_server/src/services/refactoring/inline_method.dart'; 16 import 'package:analysis_server/src/services/refactoring/inline_method.dart';
17 import 'package:analysis_server/src/services/refactoring/move_file.dart'; 17 import 'package:analysis_server/src/services/refactoring/move_file.dart';
18 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar t'; 18 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar t';
19 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart '; 19 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart ';
20 import 'package:analysis_server/src/services/refactoring/rename_import.dart'; 20 import 'package:analysis_server/src/services/refactoring/rename_import.dart';
21 import 'package:analysis_server/src/services/refactoring/rename_label.dart'; 21 import 'package:analysis_server/src/services/refactoring/rename_label.dart';
22 import 'package:analysis_server/src/services/refactoring/rename_library.dart'; 22 import 'package:analysis_server/src/services/refactoring/rename_library.dart';
23 import 'package:analysis_server/src/services/refactoring/rename_local.dart'; 23 import 'package:analysis_server/src/services/refactoring/rename_local.dart';
24 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart '; 24 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart ';
25 import 'package:analysis_server/src/services/search/search_engine.dart'; 25 import 'package:analysis_server/src/services/search/search_engine.dart';
26 import 'package:analyzer/src/generated/ast.dart'; 26 import 'package:analyzer/src/generated/ast.dart';
27 import 'package:analyzer/src/generated/element.dart'; 27 import 'package:analyzer/src/generated/element.dart';
28 import 'package:analyzer/src/generated/engine.dart'; 28 import 'package:analyzer/src/generated/engine.dart';
29 import 'package:analyzer/src/generated/source.dart'; 29 import 'package:analyzer/src/generated/source.dart';
30 import 'package:analysis_server/src/services/refactoring/convert_getter_to_metho d.dart';
30 31
31 32
32 /** 33 /**
34 * [Refactoring] to convert getters into normal [MethodDeclaration]s.
35 */
36 abstract class ConvertGetterToMethodRefactoring implements Refactoring {
37 /**
38 * Returns a new [ConvertMethodToGetterRefactoring] instance for converting
39 * [element] and all the corresponding hierarchy elements.
40 */
41 factory ConvertGetterToMethodRefactoring(SearchEngine searchEngine,
42 PropertyAccessorElement element) {
43 return new ConvertGetterToMethodRefactoringImpl(searchEngine, element);
44 }
45 }
46
47
48 /**
33 * [Refactoring] to convert normal [MethodDeclaration]s into getters. 49 * [Refactoring] to convert normal [MethodDeclaration]s into getters.
34 */ 50 */
35 abstract class ConvertMethodToGetterRefactoring implements Refactoring { 51 abstract class ConvertMethodToGetterRefactoring implements Refactoring {
36 /** 52 /**
37 * Returns a new [ConvertMethodToGetterRefactoring] instance for converting 53 * Returns a new [ConvertMethodToGetterRefactoring] instance for converting
38 * [element] and all the corresponding hierarchy elements. 54 * [element] and all the corresponding hierarchy elements.
39 */ 55 */
40 factory ConvertMethodToGetterRefactoring(SearchEngine searchEngine, 56 factory ConvertMethodToGetterRefactoring(SearchEngine searchEngine,
41 ExecutableElement element) { 57 ExecutableElement element) {
42 return new ConvertMethodToGetterRefactoringImpl(searchEngine, element); 58 return new ConvertMethodToGetterRefactoringImpl(searchEngine, element);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 * Validates that the [newName] is a valid identifier and is appropriate for 411 * Validates that the [newName] is a valid identifier and is appropriate for
396 * the type of the [Element] being renamed. 412 * the type of the [Element] being renamed.
397 * 413 *
398 * It does not perform all the checks (such as checking for conflicts with any 414 * It does not perform all the checks (such as checking for conflicts with any
399 * existing names in any of the scopes containing the current name), as many 415 * existing names in any of the scopes containing the current name), as many
400 * of these checkes require search engine. Use [checkFinalConditions] for this 416 * of these checkes require search engine. Use [checkFinalConditions] for this
401 * level of checking. 417 * level of checking.
402 */ 418 */
403 RefactoringStatus checkNewName(); 419 RefactoringStatus checkNewName();
404 } 420 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698