Skip to content

Commit a75457d

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Tweak for lookUpInheritedMethod2(), move 'importedLibraries2'.
Change-Id: If54a07700992912b81262e95a44d55635c7017bc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398589 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent dbd3daf commit a75457d

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

pkg/analyzer/lib/dart/element/element2.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,8 +1324,10 @@ abstract class InterfaceElement2 implements InstanceElement2 {
13241324
/// failed.
13251325
/// </blockquote>
13261326
// TODO(scheglov): Deprecate and remove it.
1327-
MethodElement2? lookUpInheritedMethod2(
1328-
String methodName, LibraryElement2 library);
1327+
MethodElement2? lookUpInheritedMethod2({
1328+
required String methodName,
1329+
required LibraryElement2 library,
1330+
});
13291331
}
13301332

13311333
/// The portion of an [InterfaceElement2] contributed by a single declaration.
@@ -1502,12 +1504,6 @@ abstract class LibraryElement2 implements Element2, Annotatable {
15021504
/// of this element's parent.
15031505
String get identifier;
15041506

1505-
/// The libraries that are imported into this library.
1506-
///
1507-
/// This includes all of the libraries that are imported using a prefix, and
1508-
/// those that are imported without a prefix.
1509-
List<LibraryElement2> get importedLibraries2;
1510-
15111507
/// Whether the library is the `dart:async` library.
15121508
bool get isDartAsync;
15131509

@@ -1660,6 +1656,12 @@ abstract class LibraryFragment implements Fragment, Annotatable {
16601656
/// The fragments of the top-level getters declared in this fragment.
16611657
List<GetterFragment> get getters;
16621658

1659+
/// The libraries that are imported by this unit.
1660+
///
1661+
/// This includes all of the libraries that are imported using a prefix, and
1662+
/// those that are imported without a prefix.
1663+
List<LibraryElement2> get importedLibraries2;
1664+
16631665
/// The libraries exported by this unit.
16641666
List<LibraryExport> get libraryExports2;
16651667

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,15 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
956956
@override
957957
String get identifier => '${source.uri}';
958958

959+
@override
960+
List<LibraryElement2> get importedLibraries2 {
961+
return libraryImports2
962+
.map((import) => import.importedLibrary2)
963+
.nonNulls
964+
.toSet()
965+
.toList();
966+
}
967+
959968
@override
960969
ElementKind get kind => ElementKind.COMPILATION_UNIT;
961970

@@ -6313,10 +6322,10 @@ abstract class InterfaceElementImpl2 extends InstanceElementImpl2
63136322
typeArguments: typeArguments, nullabilitySuffix: nullabilitySuffix);
63146323

63156324
@override
6316-
MethodElement2? lookUpInheritedMethod2(
6317-
String methodName,
6318-
LibraryElement2 library,
6319-
) {
6325+
MethodElement2? lookUpInheritedMethod2({
6326+
required String methodName,
6327+
required LibraryElement2 library,
6328+
}) {
63206329
return inheritanceManager
63216330
.getInherited4(
63226331
this,
@@ -6760,16 +6769,6 @@ class LibraryElementImpl extends ElementImpl
67606769
.toList();
67616770
}
67626771

6763-
@override
6764-
List<LibraryElement2> get importedLibraries2 {
6765-
return fragments
6766-
.expand((fragment) => fragment.libraryImports2)
6767-
.map((import) => import.importedLibrary2)
6768-
.nonNulls
6769-
.toSet()
6770-
.toList();
6771-
}
6772-
67736772
@override
67746773
bool get isDartAsync => name == "dart.async";
67756774

0 commit comments

Comments
 (0)