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

Side by Side Diff: pkg/analysis_services/lib/refactoring/refactoring.dart

Issue 465733002: 'Rename Local Variable' refactoring implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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';
8
7 import 'package:analysis_services/correction/change.dart'; 9 import 'package:analysis_services/correction/change.dart';
8 import 'package:analysis_services/correction/status.dart'; 10 import 'package:analysis_services/correction/status.dart';
9 import 'package:analysis_services/search/search_engine.dart'; 11 import 'package:analysis_services/search/search_engine.dart';
10 import 'package:analysis_services/src/refactoring/rename_local.dart'; 12 import 'package:analysis_services/src/refactoring/rename_local.dart';
11 import 'package:analyzer/src/generated/element.dart'; 13 import 'package:analyzer/src/generated/element.dart';
12 14
13 15
14 /** 16 /**
15 * Abstract interface for all refactorings. 17 * Abstract interface for all refactorings.
16 */ 18 */
17 abstract class Refactoring { 19 abstract class Refactoring {
18 /** 20 /**
19 * Returns the human readable name of this [Refactoring]. 21 * Returns the human readable name of this [Refactoring].
20 */ 22 */
21 String get refactoringName; 23 String get refactoringName;
22 24
23 /** 25 /**
24 * Checks all conditions - [checkInitialConditions] and 26 * Checks all conditions - [checkInitialConditions] and
25 * [checkFinalConditions] to decide if refactoring can be performed. 27 * [checkFinalConditions] to decide if refactoring can be performed.
26 */ 28 */
27 RefactoringStatus checkAllConditions(); 29 Future<RefactoringStatus> checkAllConditions();
Brian Wilkerson 2014/08/12 04:44:40 Is it really necessary to make refactorings async?
scheglov 2014/08/12 05:09:33 Unfortunately yes. SearchEngine is async, and it i
28 30
29 /** 31 /**
30 * Validates environment to check if this refactoring can be performed. 32 * Validates environment to check if this refactoring can be performed.
31 * 33 *
32 * This check may be slow, because many refactorings use search engine. 34 * This check may be slow, because many refactorings use search engine.
33 */ 35 */
34 RefactoringStatus checkFinalConditions(); 36 Future<RefactoringStatus> checkFinalConditions();
35 37
36 /** 38 /**
37 * Validates arguments to check if this refactoring can be performed. 39 * Validates arguments to check if this refactoring can be performed.
38 * 40 *
39 * This check should be quick because it is used often as arguments change. 41 * This check should be quick because it is used often as arguments change.
40 */ 42 */
41 RefactoringStatus checkInitialConditions(); 43 Future<RefactoringStatus> checkInitialConditions();
42 44
43 /** 45 /**
44 * Returns the [Change] to apply to perform this refactoring. 46 * Returns the [Change] to apply to perform this refactoring.
45 */ 47 */
46 Change createChange(); 48 Future<Change> createChange();
47 49
48 /** 50 /**
49 * Returs `true` if the [Change] created by refactoring may be unsafe, 51 * Returs `true` if the [Change] created by refactoring may be unsafe,
50 * so we want user to review the [Change] to ensure that he understands it. 52 * so we want user to review the [Change] to ensure that he understands it.
51 */ 53 */
52 bool requiresPreview(); 54 bool requiresPreview();
53 } 55 }
54 56
55 57
56 /** 58 /**
(...skipping 26 matching lines...) Expand all
83 * Validates that the [newName] is a valid identifier and is appropriate for 85 * Validates that the [newName] is a valid identifier and is appropriate for
84 * the type of the [Element] being renamed. 86 * the type of the [Element] being renamed.
85 * 87 *
86 * It does not perform all the checks (such as checking for conflicts with any 88 * It does not perform all the checks (such as checking for conflicts with any
87 * existing names in any of the scopes containing the current name), as many 89 * existing names in any of the scopes containing the current name), as many
88 * of these checkes require search engine. Use [checkFinalConditions] for this 90 * of these checkes require search engine. Use [checkFinalConditions] for this
89 * level of checking. 91 * level of checking.
90 */ 92 */
91 RefactoringStatus checkNewName(); 93 RefactoringStatus checkNewName();
92 } 94 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_services/lib/search/hierarchy.dart » ('j') | pkg/analysis_services/lib/src/correction/util.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698