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: deprecated_member_use
6-
75import 'dart:io' show Platform;
86import 'dart:isolate' ;
97
@@ -69,13 +67,13 @@ void runTests(ResolversFactory resolversFactory) {
6967 },
7068 (resolver) async {
7169 final lib = await resolver.libraryFor (entryPoint);
72- expect (lib.firstFragment.libraryImports2 .length, 2 );
70+ expect (lib.firstFragment.libraryImports .length, 2 );
7371 final libA =
7472 lib
75- ..firstFragment.libraryImports2
76- .where ((l) => l.importedLibrary2 ! .name3 == 'a' )
73+ ..firstFragment.libraryImports
74+ .where ((l) => l.importedLibrary ! .name == 'a' )
7775 .single;
78- expect (libA.getClass2 ('Foo' ), isNull);
76+ expect (libA.getClass ('Foo' ), isNull);
7977 },
8078 resolvers: createResolvers (),
8179 );
@@ -113,13 +111,13 @@ void runTests(ResolversFactory resolversFactory) {
113111 },
114112 (resolver) async {
115113 final lib = await resolver.libraryFor (entryPoint);
116- expect (lib.firstFragment.libraryImports2 .length, 2 );
114+ expect (lib.firstFragment.libraryImports .length, 2 );
117115 final libB =
118116 lib
119- ..firstFragment.libraryImports2
120- .where ((l) => l.importedLibrary2 ! .name3 == 'b' )
117+ ..firstFragment.libraryImports
118+ .where ((l) => l.importedLibrary ! .name == 'b' )
121119 .single;
122- expect (libB.getClass2 ('Foo' ), isNull);
120+ expect (libB.getClass ('Foo' ), isNull);
123121 },
124122 resolvers: createResolvers (),
125123 );
@@ -162,8 +160,8 @@ void runTests(ResolversFactory resolversFactory) {
162160 },
163161 (resolver) async {
164162 final lib = await resolver.libraryFor (entryPoint);
165- expect (lib.getClass2 ('A' ), isNotNull);
166- expect (lib.getClass2 ('B' ), isNull);
163+ expect (lib.getClass ('A' ), isNotNull);
164+ expect (lib.getClass ('B' ), isNull);
167165 },
168166 resolvers: resolvers,
169167 );
@@ -179,8 +177,8 @@ void runTests(ResolversFactory resolversFactory) {
179177 },
180178 (resolver) async {
181179 final lib = await resolver.libraryFor (entryPoint);
182- expect (lib.getClass2 ('A' ), isNull);
183- expect (lib.getClass2 ('B' ), isNotNull);
180+ expect (lib.getClass ('A' ), isNull);
181+ expect (lib.getClass ('B' ), isNotNull);
184182 },
185183 resolvers: resolvers,
186184 );
@@ -200,8 +198,8 @@ void runTests(ResolversFactory resolversFactory) {
200198 },
201199 (resolver) async {
202200 final lib = await resolver.libraryFor (entryPoint);
203- expect (lib.getClass2 ('A' ), isNotNull);
204- expect (lib.getClass2 ('B' ), isNull);
201+ expect (lib.getClass ('A' ), isNotNull);
202+ expect (lib.getClass ('B' ), isNull);
205203 },
206204 resolvers: resolvers,
207205 );
@@ -221,8 +219,8 @@ void runTests(ResolversFactory resolversFactory) {
221219 },
222220 (resolver) async {
223221 final lib = await resolver.libraryFor (entryPoint);
224- expect (lib.getClass2 ('A' ), isNull);
225- expect (lib.getClass2 ('B' ), isNotNull);
222+ expect (lib.getClass ('A' ), isNull);
223+ expect (lib.getClass ('B' ), isNotNull);
226224 },
227225 resolvers: resolvers,
228226 );
@@ -246,14 +244,14 @@ void runTests(ResolversFactory resolversFactory) {
246244 final sourcesWithoutB = Map .of (sources)..remove ('a|web/b.dart' );
247245 await resolveSources (sourcesWithoutB, (resolver) async {
248246 final lib = await resolver.libraryFor (entryPoint);
249- final clazz = lib.getClass2 ('A' );
247+ final clazz = lib.getClass ('A' );
250248 expect (clazz, isNotNull);
251249 expect (clazz! .interfaces, isEmpty);
252250 }, resolvers: resolvers);
253251
254252 await resolveSources (sources, (resolver) async {
255253 final lib = await resolver.libraryFor (entryPoint);
256- final clazz = lib.getClass2 ('A' );
254+ final clazz = lib.getClass ('A' );
257255 expect (clazz, isNotNull);
258256 expect (clazz! .interfaces, hasLength (1 ));
259257 expect (clazz.interfaces.first.getDisplayString (), 'C' );
@@ -454,21 +452,21 @@ void runTests(ResolversFactory resolversFactory) {
454452 expect (main, isNotNull);
455453
456454 final other = await resolver.libraryFor (otherId);
457- expect (other.name3 , 'other' );
455+ expect (other.name , 'other' );
458456 });
459457 });
460458
461459 test ('are included in library stream' , () {
462460 return runWith ((resolver) async {
463461 await expectLater (
464- resolver.libraries.map ((l) => l.name3 ),
462+ resolver.libraries.map ((l) => l.name ),
465463 neverEmits ('other' ),
466464 );
467465
468466 await resolver.libraryFor (otherId);
469467
470468 await expectLater (
471- resolver.libraries.map ((l) => l.name3 ),
469+ resolver.libraries.map ((l) => l.name ),
472470 emitsThrough ('other' ),
473471 );
474472 });
@@ -516,7 +514,7 @@ void runTests(ResolversFactory resolversFactory) {
516514 },
517515 (resolver) async {
518516 final lib = await resolver.libraryFor (entryPoint);
519- final clazz = lib.getClass2 ('A' );
517+ final clazz = lib.getClass ('A' );
520518 expect (clazz, isNotNull);
521519 expect (clazz! .interfaces, isEmpty);
522520 },
@@ -537,7 +535,7 @@ void runTests(ResolversFactory resolversFactory) {
537535 },
538536 (resolver) async {
539537 final lib = await resolver.libraryFor (entryPoint);
540- final clazz = lib.getClass2 ('A' );
538+ final clazz = lib.getClass ('A' );
541539 expect (clazz, isNotNull);
542540 expect (clazz! .interfaces, hasLength (1 ));
543541 expect (clazz.interfaces.first.getDisplayString (), 'B' );
@@ -562,7 +560,7 @@ void runTests(ResolversFactory resolversFactory) {
562560 },
563561 (resolver) async {
564562 final lib = await resolver.libraryFor (entryPoint);
565- final clazz = lib.getClass2 ('A' );
563+ final clazz = lib.getClass ('A' );
566564 expect (clazz, isNotNull);
567565 expect (clazz! .interfaces, hasLength (1 ));
568566 expect (clazz.interfaces.first.getDisplayString (), 'B' );
@@ -582,7 +580,7 @@ void runTests(ResolversFactory resolversFactory) {
582580 },
583581 (resolver) async {
584582 final lib = await resolver.libraryFor (entryPoint);
585- final clazz = lib.getClass2 ('A' );
583+ final clazz = lib.getClass ('A' );
586584 expect (clazz, isNotNull);
587585 expect (clazz! .interfaces, isEmpty);
588586 },
@@ -608,7 +606,7 @@ void runTests(ResolversFactory resolversFactory) {
608606 final libs =
609607 await resolver.libraries.where ((l) => ! l.isInSdk).toList ();
610608 expect (
611- libs.map ((l) => l.name3 ),
609+ libs.map ((l) => l.name ),
612610 unorderedEquals (['a.main' , 'a.a' , 'a.b' , 'a.c' , 'a.d' ]),
613611 );
614612 },
@@ -673,12 +671,7 @@ void runTests(ResolversFactory resolversFactory) {
673671 (resolver) async {
674672 final main = (await resolver.findLibraryByName ('web.main' ))! ;
675673 final meta =
676- main
677- .getClass2 ('Foo' )!
678- .supertype!
679- .element3
680- .metadata2
681- .annotations[0 ];
674+ main.getClass ('Foo' )! .supertype! .element.metadata.annotations[0 ];
682675 expect (meta, isNotNull);
683676 expect (meta.computeConstantValue ()? .toIntValue (), 0 );
684677 },
@@ -700,8 +693,7 @@ void runTests(ResolversFactory resolversFactory) {
700693 import 'package:a/a.dart'; ''' ,
701694 },
702695 (resolver) async {
703- final libs =
704- await resolver.libraries.map ((lib) => lib.name3).toList ();
696+ final libs = await resolver.libraries.map ((lib) => lib.name).toList ();
705697 expect (libs.contains ('a' ), isTrue);
706698 expect (libs.contains ('b' ), isTrue);
707699 },
@@ -725,8 +717,8 @@ void runTests(ResolversFactory resolversFactory) {
725717 (resolver) async {
726718 final entry = await resolver.libraryFor (AssetId ('a' , 'lib/a.dart' ));
727719 final classDefinition =
728- entry.firstFragment.libraryImports2
729- .map ((l) => l.importedLibrary2 ! . getClass2 ('SomeClass' ))
720+ entry.firstFragment.libraryImports
721+ .map ((l) => l.importedLibrary ! . getClass ('SomeClass' ))
730722 .singleWhere ((c) => c != null )! ;
731723 expect (
732724 await resolver.assetIdForElement (classDefinition),
@@ -758,11 +750,11 @@ void runTests(ResolversFactory resolversFactory) {
758750 final entry = await resolver.libraryFor (AssetId ('a' , 'lib/a.dart' ));
759751 final element =
760752 entry.topLevelFunctions
761- .firstWhere ((e) => e.name3 == 'main' )
762- .metadata2
753+ .firstWhere ((e) => e.name == 'main' )
754+ .metadata
763755 .annotations
764756 .single
765- .element2 ! ;
757+ .element ! ;
766758 await expectLater (
767759 () => resolver.assetIdForElement (element),
768760 throwsA (isA <UnresolvableAssetException >()),
@@ -795,7 +787,7 @@ int? get x => 1;
795787 );
796788 final errors =
797789 await lib.session.getErrors ('/a/web/main.dart' ) as ErrorsResult ;
798- expect (errors.errors , isEmpty);
790+ expect (errors.diagnostics , isEmpty);
799791 },
800792 resolvers: createResolvers (),
801793 ),
@@ -819,7 +811,7 @@ int? get x => 1;
819811 await resolver.assetIdForElement (lib),
820812 );
821813 expect (
822- await newLib.session.getResolvedLibraryByElement2 (newLib),
814+ await newLib.session.getResolvedLibraryByElement (newLib),
823815 isA <ResolvedLibraryResult >(),
824816 );
825817 }, resolvers: resolvers);
@@ -1042,7 +1034,7 @@ int? get x => 1;
10421034 await resolveSources ({'a|lib/a.dart' : '' }, (resolver) async {
10431035 final convert = await resolver.findLibraryByName ('dart.convert' );
10441036 expect (convert, isNotNull);
1045- expect (convert! .getClass2 ('Codec' ), isNotNull);
1037+ expect (convert! .getClass ('Codec' ), isNotNull);
10461038 final allLibraries = await resolver.libraries.toList ();
10471039 expect (
10481040 allLibraries.map ((e) => e.uri.toString ()),
@@ -1141,14 +1133,14 @@ int? get x => 1;
11411133 },
11421134 (resolver) async {
11431135 final entry = await resolver.libraryFor (AssetId ('a' , 'lib/a.dart' ));
1144- final classDefinition = entry.getClass2 ('MyClass' )! ;
1145- final color = classDefinition.getField2 ('color' )! ;
1136+ final classDefinition = entry.getClass ('MyClass' )! ;
1137+ final color = classDefinition.getField ('color' )! ;
11461138
11471139 if (isFlutter) {
11481140 expect (color.type.element! .name, equals ('Color' ));
11491141 expect (color.type.element! .library! .name, equals ('dart.ui' ));
11501142 expect (
1151- color.type.element3 ! .library2 ! .uri.toString (),
1143+ color.type.element ! .library ! .uri.toString (),
11521144 equals ('dart:ui' ),
11531145 );
11541146 } else {
0 commit comments