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

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

Issue 526583002: 'Inline Method' refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments Created 6 years, 3 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/extract_local.dart'; 12 import 'package:analysis_server/src/services/refactoring/extract_local.dart';
13 import 'package:analysis_server/src/services/refactoring/extract_method.dart'; 13 import 'package:analysis_server/src/services/refactoring/extract_method.dart';
14 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; 14 import 'package:analysis_server/src/services/refactoring/inline_local.dart';
15 import 'package:analysis_server/src/services/refactoring/inline_method.dart';
15 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar t'; 16 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar t';
16 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart '; 17 import 'package:analysis_server/src/services/refactoring/rename_constructor.dart ';
17 import 'package:analysis_server/src/services/refactoring/rename_import.dart'; 18 import 'package:analysis_server/src/services/refactoring/rename_import.dart';
18 import 'package:analysis_server/src/services/refactoring/rename_library.dart'; 19 import 'package:analysis_server/src/services/refactoring/rename_library.dart';
19 import 'package:analysis_server/src/services/refactoring/rename_local.dart'; 20 import 'package:analysis_server/src/services/refactoring/rename_local.dart';
20 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart '; 21 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart ';
21 import 'package:analysis_server/src/services/search/search_engine.dart'; 22 import 'package:analysis_server/src/services/search/search_engine.dart';
22 import 'package:analyzer/src/generated/ast.dart'; 23 import 'package:analyzer/src/generated/ast.dart';
23 import 'package:analyzer/src/generated/element.dart'; 24 import 'package:analyzer/src/generated/element.dart';
24 25
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 192 }
192 193
193 /** 194 /**
194 * Returns the number of references to the [VariableElement]. 195 * Returns the number of references to the [VariableElement].
195 */ 196 */
196 int get referenceCount; 197 int get referenceCount;
197 } 198 }
198 199
199 200
200 /** 201 /**
202 * [Refactoring] to inline an [ExecutableElement].
203 */
204 abstract class InlineMethodRefactoring implements Refactoring {
205 /**
206 * Returns a new [InlineMethodRefactoring] instance.
207 */
208 factory InlineMethodRefactoring(SearchEngine searchEngine,
209 CompilationUnit unit, int offset) {
210 return new InlineMethodRefactoringImpl(searchEngine, unit, offset);
211 }
212
213 /**
214 * True if the method being inlined should be removed.
215 * It is an error if this field is `true` and [inlineAll] is `false`.
216 */
217 void set deleteSource(bool deleteSource);
218
219 /**
220 * True if all invocations of the method should be inlined, or false if only
221 * the invocation site used to create this refactoring should be inlined.
222 */
223 void set inlineAll(bool inlineAll);
224 }
225
226
227 /**
201 * Abstract interface for all refactorings. 228 * Abstract interface for all refactorings.
202 */ 229 */
203 abstract class Refactoring { 230 abstract class Refactoring {
204 /** 231 /**
205 * The ids of source edits that are not known to be valid. 232 * The ids of source edits that are not known to be valid.
206 * 233 *
207 * An edit is not known to be valid if there was insufficient type information 234 * An edit is not known to be valid if there was insufficient type information
208 * for the server to be able to determine whether or not the code needs to be 235 * for the server to be able to determine whether or not the code needs to be
209 * modified, such as when a member is being renamed and there is a reference 236 * modified, such as when a member is being renamed and there is a reference
210 * to a member from an unknown type. This field will be omitted if the change 237 * to a member from an unknown type. This field will be omitted if the change
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 * Validates that the [newName] is a valid identifier and is appropriate for 325 * Validates that the [newName] is a valid identifier and is appropriate for
299 * the type of the [Element] being renamed. 326 * the type of the [Element] being renamed.
300 * 327 *
301 * It does not perform all the checks (such as checking for conflicts with any 328 * It does not perform all the checks (such as checking for conflicts with any
302 * existing names in any of the scopes containing the current name), as many 329 * existing names in any of the scopes containing the current name), as many
303 * of these checkes require search engine. Use [checkFinalConditions] for this 330 * of these checkes require search engine. Use [checkFinalConditions] for this
304 * level of checking. 331 * level of checking.
305 */ 332 */
306 RefactoringStatus checkNewName(); 333 RefactoringStatus checkNewName();
307 } 334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698