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; | 5 library services.refactoring; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart' | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' |
10 show RefactoringMethodParameter, SourceChange; | 10 show RefactoringMethodParameter, SourceChange; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 * the variable. | 119 * the variable. |
120 */ | 120 */ |
121 List<int> get offsets; | 121 List<int> get offsets; |
122 | 122 |
123 /** | 123 /** |
124 * Validates that the [name] is a valid identifier and is appropriate for | 124 * Validates that the [name] is a valid identifier and is appropriate for |
125 * local variable. | 125 * local variable. |
126 * | 126 * |
127 * It does not perform all the checks (such as checking for conflicts with any | 127 * It does not perform all the checks (such as checking for conflicts with any |
128 * existing names in any of the scopes containing the current name), as many | 128 * existing names in any of the scopes containing the current name), as many |
129 * of these checkes require search engine. Use [checkFinalConditions] for this | 129 * of these checks require search engine. Use [checkFinalConditions] for this |
130 * level of checking. | 130 * level of checking. |
131 */ | 131 */ |
132 RefactoringStatus checkName(); | 132 RefactoringStatus checkName(); |
133 } | 133 } |
134 | 134 |
135 /** | 135 /** |
136 * [Refactoring] to extract an [Expression] or [Statement]s into a new method. | 136 * [Refactoring] to extract an [Expression] or [Statement]s into a new method. |
137 */ | 137 */ |
138 abstract class ExtractMethodRefactoring implements Refactoring { | 138 abstract class ExtractMethodRefactoring implements Refactoring { |
139 /** | 139 /** |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 * The return type that should be defined for the method. | 208 * The return type that should be defined for the method. |
209 */ | 209 */ |
210 void set returnType(String returnType); | 210 void set returnType(String returnType); |
211 | 211 |
212 /** | 212 /** |
213 * Validates that the [name] is a valid identifier and is appropriate for a | 213 * Validates that the [name] is a valid identifier and is appropriate for a |
214 * method. | 214 * method. |
215 * | 215 * |
216 * It does not perform all the checks (such as checking for conflicts with any | 216 * It does not perform all the checks (such as checking for conflicts with any |
217 * existing names in any of the scopes containing the current name), as many | 217 * existing names in any of the scopes containing the current name), as many |
218 * of these checkes require search engine. Use [checkFinalConditions] for this | 218 * of these checks require search engine. Use [checkFinalConditions] for this |
219 * level of checking. | 219 * level of checking. |
220 */ | 220 */ |
221 RefactoringStatus checkName(); | 221 RefactoringStatus checkName(); |
222 } | 222 } |
223 | 223 |
224 /** | 224 /** |
225 * [Refactoring] to inline a local [VariableElement]. | 225 * [Refactoring] to inline a local [VariableElement]. |
226 */ | 226 */ |
227 abstract class InlineLocalRefactoring implements Refactoring { | 227 abstract class InlineLocalRefactoring implements Refactoring { |
228 /** | 228 /** |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 * Returns the old name of the [Element] being renamed. | 420 * Returns the old name of the [Element] being renamed. |
421 */ | 421 */ |
422 String get oldName; | 422 String get oldName; |
423 | 423 |
424 /** | 424 /** |
425 * Validates that the [newName] is a valid identifier and is appropriate for | 425 * Validates that the [newName] is a valid identifier and is appropriate for |
426 * the type of the [Element] being renamed. | 426 * the type of the [Element] being renamed. |
427 * | 427 * |
428 * It does not perform all the checks (such as checking for conflicts with any | 428 * It does not perform all the checks (such as checking for conflicts with any |
429 * existing names in any of the scopes containing the current name), as many | 429 * existing names in any of the scopes containing the current name), as many |
430 * of these checkes require search engine. Use [checkFinalConditions] for this | 430 * of these checks require search engine. Use [checkFinalConditions] for this |
431 * level of checking. | 431 * level of checking. |
432 */ | 432 */ |
433 RefactoringStatus checkNewName(); | 433 RefactoringStatus checkNewName(); |
434 } | 434 } |
435 | 435 |
436 /** | 436 /** |
437 * Cache for accessing resolved [CompilationUnit]s by [Element]s. | 437 * Cache for accessing resolved [CompilationUnit]s by [Element]s. |
438 * | 438 * |
439 * Must by short-lived. | 439 * Must by short-lived. |
440 * | 440 * |
(...skipping 14 matching lines...) Expand all Loading... |
455 element.getAncestor((e) => e is CompilationUnitElement) | 455 element.getAncestor((e) => e is CompilationUnitElement) |
456 as CompilationUnitElement; | 456 as CompilationUnitElement; |
457 CompilationUnit unit = _map[unitElement]; | 457 CompilationUnit unit = _map[unitElement]; |
458 if (unit == null) { | 458 if (unit == null) { |
459 unit = await _astProvider.getResolvedUnitForElement(element); | 459 unit = await _astProvider.getResolvedUnitForElement(element); |
460 _map[unitElement] = unit; | 460 _map[unitElement] = unit; |
461 } | 461 } |
462 return unit; | 462 return unit; |
463 } | 463 } |
464 } | 464 } |
OLD | NEW |