Skip to content

Commit b49464c

Browse files
bwilkersonCommit Queue
authored andcommitted
Migrate inline_method
Change-Id: Iff0d8dac16c0ea8ede807a393276b980d4d5a7f7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397101 Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent 06111a5 commit b49464c

File tree

4 files changed

+114
-74
lines changed

4 files changed

+114
-74
lines changed

pkg/analysis_server/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ lib/src/services/refactoring/legacy/extract_local.dart
5353
lib/src/services/refactoring/legacy/extract_method.dart
5454
lib/src/services/refactoring/legacy/extract_widget.dart
5555
lib/src/services/refactoring/legacy/inline_local.dart
56-
lib/src/services/refactoring/legacy/inline_method.dart
5756
lib/src/services/refactoring/legacy/move_file.dart
5857
lib/src/services/refactoring/legacy/refactoring.dart
5958
lib/src/services/refactoring/legacy/refactoring_internal.dart

pkg/analysis_server/lib/src/services/correction/util.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,17 @@ LocalVariableElement? getLocalVariableElement(SimpleIdentifier node) {
227227
return null;
228228
}
229229

230+
/// Return the variable's element if [node] is a reference to a local variable.
231+
///
232+
/// Returns `null` if it isn't a reference to a local variable.
233+
LocalVariableElement2? getLocalVariableElement2(SimpleIdentifier node) {
234+
var element = node.element;
235+
if (element is LocalVariableElement2) {
236+
return element;
237+
}
238+
return null;
239+
}
240+
230241
/// Return the nearest common ancestor of the given [nodes].
231242
AstNode? getNearestCommonAncestor(List<AstNode> nodes) {
232243
// may be no nodes
@@ -279,6 +290,17 @@ ParameterElement? getParameterElement(SimpleIdentifier node) {
279290
return null;
280291
}
281292

293+
/// Returns the parameter's element if the [node] is a reference to a parameter.
294+
///
295+
/// Returns `null` if it isn't a reference to a parameter.
296+
FormalParameterElement? getParameterElement2(SimpleIdentifier node) {
297+
var element = node.element;
298+
if (element is FormalParameterElement) {
299+
return element;
300+
}
301+
return null;
302+
}
303+
282304
/// Return parent [AstNode]s from compilation unit (at index "0") to the given
283305
/// [node].
284306
List<AstNode> getParents(AstNode node) {

0 commit comments

Comments
 (0)