2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- // ignore_for_file: deprecated_member_use until analyzer 7 support is dropped.
6
-
7
- import 'package:analyzer/dart/element/element2.dart' ;
5
+ import 'package:analyzer/dart/element/element.dart' ;
8
6
import 'package:build/build.dart' ;
9
7
import 'package:build_test/build_test.dart' ;
10
8
import 'package:source_gen/src/span_for_element.dart' ;
@@ -13,7 +11,7 @@ import 'package:test/test.dart';
13
11
14
12
void main () {
15
13
glyph.ascii = true ;
16
- late LibraryElement2 library;
14
+ late LibraryElement library;
17
15
late Resolver resolver;
18
16
19
17
setUpAll (() async {
@@ -41,7 +39,7 @@ abstract class Example implements List {
41
39
42
40
test ('should highlight the use of "class Example"' , () async {
43
41
expect (
44
- spanForElement (library.getClass2 ('Example' )! ).message ('Here it is' ),
42
+ spanForElement (library.getClass ('Example' )! ).message ('Here it is' ),
45
43
r"""
46
44
line 3, column 16 of package:test_lib/test_lib.dart: Here it is
47
45
,
@@ -54,7 +52,7 @@ line 3, column 16 of package:test_lib/test_lib.dart: Here it is
54
52
test ('should correctly highlight getter' , () async {
55
53
expect (
56
54
spanForElement (
57
- library.getClass2 ('Example' )! .getField2 ('getter' )! ,
55
+ library.getClass ('Example' )! .getField ('getter' )! ,
58
56
).message ('Here it is' ),
59
57
r"""
60
58
line 4, column 15 of package:test_lib/test_lib.dart: Here it is
@@ -68,7 +66,7 @@ line 4, column 15 of package:test_lib/test_lib.dart: Here it is
68
66
test ('should correctly highlight setter' , () async {
69
67
expect (
70
68
spanForElement (
71
- library.getClass2 ('Example' )! .getField2 ('setter' )! ,
69
+ library.getClass ('Example' )! .getField ('setter' )! ,
72
70
).message ('Here it is' ),
73
71
r"""
74
72
line 5, column 7 of package:test_lib/test_lib.dart: Here it is
@@ -82,7 +80,7 @@ line 5, column 7 of package:test_lib/test_lib.dart: Here it is
82
80
test ('should correctly highlight field' , () async {
83
81
expect (
84
82
spanForElement (
85
- library.getClass2 ('Example' )! .getField2 ('field' )! ,
83
+ library.getClass ('Example' )! .getField ('field' )! ,
86
84
).message ('Here it is' ),
87
85
r"""
88
86
line 6, column 7 of package:test_lib/test_lib.dart: Here it is
@@ -96,7 +94,7 @@ line 6, column 7 of package:test_lib/test_lib.dart: Here it is
96
94
test ('highlight getter with getter/setter property' , () async {
97
95
expect (
98
96
spanForElement (
99
- library.getClass2 ('Example' )! .getField2 ('fieldProp' )! ,
97
+ library.getClass ('Example' )! .getField ('fieldProp' )! ,
100
98
).message ('Here it is' ),
101
99
r"""
102
100
line 7, column 11 of package:test_lib/test_lib.dart: Here it is
@@ -109,7 +107,7 @@ line 7, column 11 of package:test_lib/test_lib.dart: Here it is
109
107
110
108
test ('highlights based on AstNode source location' , () async {
111
109
final element =
112
- library.getClass2 ('Example' )! .getField2 ('field' )! .firstFragment;
110
+ library.getClass ('Example' )! .getField ('field' )! .firstFragment;
113
111
final node = (await resolver.astNodeFor (element, resolve: true ))! ;
114
112
expect (spanForNode (node).message ('Here it is' ), r"""
115
113
line 6, column 7 of package:test_lib/test_lib.dart: Here it is
0 commit comments