|
4 | 4 |
|
5 | 5 | // ignore_for_file: non_constant_identifier_names |
6 | 6 |
|
7 | | -// ignore_for_file: analyzer_use_new_elements |
8 | | - |
9 | | -import 'package:analyzer/dart/element/element.dart'; |
| 7 | +import 'package:analyzer/dart/element/element2.dart'; |
10 | 8 | import 'package:analyzer/dart/element/type.dart'; |
11 | 9 | import 'package:analyzer/source/line_info.dart'; |
12 | 10 | import 'package:async/async.dart'; |
@@ -181,9 +179,9 @@ void main() async { |
181 | 179 | 'Verify annotations and their type arguments render on type parameters ' |
182 | 180 | 'for typedefs', |
183 | 181 | skip: 'dart-lang/sdk#46064', () { |
184 | | - expect((F.aliasedType as FunctionType).typeFormals.first.metadata, |
| 182 | + expect((F.aliasedType as FunctionType).typeParameters.first.metadata2, |
185 | 183 | isNotEmpty); |
186 | | - expect((F.aliasedType as FunctionType).parameters.first.metadata, |
| 184 | + expect((F.aliasedType as FunctionType).formalParameters.first.metadata2, |
187 | 185 | isNotEmpty); |
188 | 186 | // TODO(jcollins-g): add rendering verification once we have data from |
189 | 187 | // analyzer. |
@@ -234,7 +232,7 @@ void main() async { |
234 | 232 | void expectTypedefs(Typedef t, String modelTypeToString, |
235 | 233 | Iterable<String> genericParameters) { |
236 | 234 | expect(t.modelType.toString(), equals(modelTypeToString)); |
237 | | - expect(t.element.typeParameters.map((p) => p.toString()), |
| 235 | + expect(t.element2.typeParameters2.map((p) => p.toString()), |
238 | 236 | orderedEquals(genericParameters)); |
239 | 237 | } |
240 | 238 |
|
@@ -909,18 +907,24 @@ void main() async { |
909 | 907 | }); |
910 | 908 |
|
911 | 909 | test('can import other libraries with unusual URIs', () { |
| 910 | + final importLists = fakeLibrary.element2.fragments |
| 911 | + .map((fragment) => fragment.libraryImports2); |
| 912 | + final exportLists = fakeLibrary.element2.fragments |
| 913 | + .map((fragment) => fragment.libraryExports2); |
912 | 914 | final fakeLibraryImportedExported = <Library>{ |
913 | | - for (final l in <LibraryElement>{ |
914 | | - ...fakeLibrary.element.definingCompilationUnit.libraryImports |
| 915 | + for (final l in <LibraryElement2>{ |
| 916 | + ...importLists |
| 917 | + .expand((imports) => imports) |
915 | 918 | .map((import) => import.uri) |
916 | 919 | .whereType<DirectiveUriWithLibrary>() |
917 | | - .map((uri) => uri.library), |
918 | | - ...fakeLibrary.element.definingCompilationUnit.libraryExports |
919 | | - .map((import) => import.uri) |
| 920 | + .map((uri) => uri.library2), |
| 921 | + ...exportLists |
| 922 | + .expand((exports) => exports) |
| 923 | + .map((export) => export.uri) |
920 | 924 | .whereType<DirectiveUriWithLibrary>() |
921 | | - .map((uri) => uri.library) |
| 925 | + .map((uri) => uri.library2) |
922 | 926 | }) |
923 | | - packageGraph.getModelForElement(l) as Library |
| 927 | + packageGraph.getModelForElement2(l) as Library |
924 | 928 | }; |
925 | 929 | expect(fakeLibraryImportedExported.any((l) => l.name == 'import_unusual'), |
926 | 930 | isTrue); |
@@ -1182,7 +1186,7 @@ void main() async { |
1182 | 1186 | contains( |
1183 | 1187 | '<a href="%%__HTMLBASE_dartdoc_internal__%%reexport_two/BaseReexported/action.html">ExtendedBaseReexported.action</a></p>')); |
1184 | 1188 | var doAwesomeStuffWarnings = packageGraph.packageWarningCounter |
1185 | | - .countedWarnings[doAwesomeStuff.element] ?? |
| 1189 | + .countedWarnings2[doAwesomeStuff.element2] ?? |
1186 | 1190 | {}; |
1187 | 1191 | expect( |
1188 | 1192 | doAwesomeStuffWarnings, |
@@ -1682,7 +1686,7 @@ void main() async { |
1682 | 1686 | fakeLibrary.classes.wherePublic.named('MIEEMixinWithOverride'); |
1683 | 1687 | var problematicOperator = |
1684 | 1688 | MIEEMixinWithOverride.inheritedOperators.named('operator []='); |
1685 | | - expect(problematicOperator.element.enclosingElement3.name, |
| 1689 | + expect(problematicOperator.element2.enclosingElement2?.name3, |
1686 | 1690 | equals('_MIEEPrivateOverride')); |
1687 | 1691 | expect(problematicOperator.canonicalModelElement!.enclosingElement!.name, |
1688 | 1692 | equals('MIEEMixinWithOverride')); |
@@ -3572,7 +3576,7 @@ String? topLevelFunction(int param1, bool param2, Cool coolBeans, |
3572 | 3576 | test('inheritance of docs from SDK works for getter/setter combos', () { |
3573 | 3577 | expect( |
3574 | 3578 | ExtraSpecialListLength |
3575 | | - .getter!.documentationFrom.first.element.library!.name, |
| 3579 | + .getter!.documentationFrom.first.element2.library2!.name3, |
3576 | 3580 | equals('dart.core')); |
3577 | 3581 | expect(ExtraSpecialListLength.oneLineDoc == '', isFalse); |
3578 | 3582 | }); |
|
0 commit comments