File tree Expand file tree Collapse file tree 4 files changed +114
-74
lines changed
test/services/refactoring/legacy Expand file tree Collapse file tree 4 files changed +114
-74
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ lib/src/services/refactoring/legacy/extract_local.dart
5353lib/src/services/refactoring/legacy/extract_method.dart
5454lib/src/services/refactoring/legacy/extract_widget.dart
5555lib/src/services/refactoring/legacy/inline_local.dart
56- lib/src/services/refactoring/legacy/inline_method.dart
5756lib/src/services/refactoring/legacy/move_file.dart
5857lib/src/services/refactoring/legacy/refactoring.dart
5958lib/src/services/refactoring/legacy/refactoring_internal.dart
Original file line number Diff line number Diff 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] .
231242AstNode ? 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] .
284306List <AstNode > getParents (AstNode node) {
You can’t perform that action at this time.
0 commit comments