Skip to content

Commit ea62736

Browse files
pqCommit Queue
authored andcommitted
[element model] migrate find_node
Change-Id: I41ef6e8a0ac8341d97677fb343a63c3e220880b6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406083 Auto-Submit: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent ce1f3e9 commit ea62736

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

pkg/analyzer/lib/src/test_utilities/find_node.dart

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// ignore_for_file: analyzer_use_new_elements
6-
75
import 'package:analyzer/dart/ast/visitor.dart';
8-
import 'package:analyzer/dart/element/element.dart';
96
import 'package:analyzer/dart/element/element2.dart';
107
import 'package:analyzer/src/dart/ast/ast.dart';
118
import 'package:analyzer/src/dart/ast/utilities.dart';
@@ -246,12 +243,7 @@ class FindNode {
246243
return _node(search, (n) => n is BinaryExpression);
247244
}
248245

249-
BindPatternVariableElement bindPatternVariableElement(String search) {
250-
var node = declaredVariablePattern(search);
251-
return node.declaredElement!;
252-
}
253-
254-
BindPatternVariableElement2 bindPatternVariableElement2(String search) {
246+
BindPatternVariableElement2 bindPatternVariableElement(String search) {
255247
var node = declaredVariablePattern(search);
256248
return node.declaredElement2!;
257249
}

pkg/analyzer/test/src/dart/analysis/search_test.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2722,7 +2722,7 @@ void f(x) {
27222722
v();
27232723
}
27242724
''');
2725-
var element = findNode.bindPatternVariableElement2('v) =');
2725+
var element = findNode.bindPatternVariableElement('v) =');
27262726
await assertElementReferencesText(element, r'''
27272727
<testLibraryFragment>::@function::f
27282728
29 3:3 |v| WRITE
@@ -2740,7 +2740,7 @@ void f(Object? x) {
27402740
}
27412741
}
27422742
''');
2743-
var element = findNode.bindPatternVariableElement2('v)');
2743+
var element = findNode.bindPatternVariableElement('v)');
27442744
await assertElementReferencesText(element, r'''
27452745
<testLibraryFragment>::@function::f
27462746
46 3:5 |v| READ
@@ -2756,7 +2756,7 @@ void f(Object? x) {
27562756
}
27572757
}
27582758
''');
2759-
var element = findNode.bindPatternVariableElement2('v]');
2759+
var element = findNode.bindPatternVariableElement('v]');
27602760
await assertElementReferencesText(element, r'''
27612761
<testLibraryFragment>::@function::f
27622762
57 3:5 |v| READ
@@ -2788,7 +2788,7 @@ Object f(Object? x) => switch (0) {
27882788
_ => -1,
27892789
}
27902790
''');
2791-
var element = findNode.bindPatternVariableElement2('int v');
2791+
var element = findNode.bindPatternVariableElement('int v');
27922792
await assertElementReferencesText(element, r'''
27932793
<testLibraryFragment>::@function::f
27942794
49 2:14 |v| READ
@@ -2804,7 +2804,7 @@ var f = switch (0) {
28042804
_ => -1,
28052805
}
28062806
''');
2807-
var element = findNode.bindPatternVariableElement2('int v');
2807+
var element = findNode.bindPatternVariableElement('int v');
28082808
await assertElementReferencesText(element, r'''
28092809
<testLibraryFragment>::@topLevelVariable::f
28102810
34 2:14 |v| READ
@@ -2824,7 +2824,7 @@ void f(Object? x) {
28242824
}
28252825
}
28262826
''');
2827-
var element = findNode.bindPatternVariableElement2('int v when');
2827+
var element = findNode.bindPatternVariableElement('int v when');
28282828
await assertElementReferencesText(element, r'''
28292829
<testLibraryFragment>::@function::f
28302830
55 3:21 |v| READ
@@ -2845,7 +2845,7 @@ void f(Object? x) {
28452845
}
28462846
}
28472847
''');
2848-
var element = findNode.bindPatternVariableElement2('int v when');
2848+
var element = findNode.bindPatternVariableElement('int v when');
28492849
await assertElementReferencesText(element, r'''
28502850
<testLibraryFragment>::@function::f
28512851
55 3:21 |v| READ

0 commit comments

Comments
 (0)