Skip to content

Commit 3ef3190

Browse files
scheglovCommit Queue
authored andcommitted
Parts. Un-deprecate LibraryElement.exportedLibraries/importedLibraries
They are used mostly as dependency tracking, because without combinators we don't know specific elements exported/imported. But for such dependency purpose CompilationUnitElement level "dependencies" are useless, so we should keep them at LibraryElement, but not add to CompilationUnitElement. Change-Id: I14aaf14debaf167f29740e86d82ff2c02e241569 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389142 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent be5235b commit 3ef3190

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

pkg/analyzer/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.11.0-dev
2+
* Un-deprecated `LibraryElement.exportedLibraries`.
3+
* Un-deprecated `LibraryElement.importedLibraries`.
4+
15
## 6.10.0
26
* Deprecated `LibraryElement.accessibleExtensions`, use
37
`CompilationUnitElement.accessibleExtensions` instead.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,6 @@ abstract class LibraryElement
19161916
FunctionElement? get entryPoint;
19171917

19181918
/// The libraries that are exported from this library.
1919-
@Deprecated('Use CompilationUnitElement.libraryExports')
19201919
List<LibraryElement> get exportedLibraries;
19211920

19221921
/// The export [Namespace] of this library.
@@ -1930,7 +1929,6 @@ abstract class LibraryElement
19301929
///
19311930
/// This includes all of the libraries that are imported using a prefix, and
19321931
/// those that are imported without a prefix.
1933-
@Deprecated('Use CompilationUnitElement.libraryImports')
19341932
List<LibraryElement> get importedLibraries;
19351933

19361934
/// Whether the library is an application that can be run in the browser.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5780,11 +5780,11 @@ class LibraryElementImpl extends LibraryOrAugmentationElementImpl
57805780
return declarations.toList();
57815781
}
57825782

5783-
@Deprecated('Use CompilationUnitElement.libraryExports')
57845783
@override
57855784
List<LibraryElementImpl> get exportedLibraries {
5786-
return libraryExports
5787-
.map((import) => import.exportedLibrary)
5785+
return fragments
5786+
.expand((fragment) => fragment.libraryExports)
5787+
.map((export) => export.exportedLibrary)
57885788
.nonNulls
57895789
.toSet()
57905790
.toList();
@@ -5902,10 +5902,10 @@ class LibraryElementImpl extends LibraryOrAugmentationElementImpl
59025902
@override
59035903
String get identifier => '${_definingCompilationUnit.source.uri}';
59045904

5905-
@Deprecated('Use CompilationUnitElement.libraryImports')
59065905
@override
59075906
List<LibraryElementImpl> get importedLibraries {
5908-
return libraryImports
5907+
return fragments
5908+
.expand((fragment) => fragment.libraryImports)
59095909
.map((import) => import.importedLibrary)
59105910
.nonNulls
59115911
.toSet()

pkg/analyzer/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: analyzer
2-
version: 6.10.0
2+
version: 6.11.0-dev
33
description: >-
44
This package provides a library that performs static analysis of Dart code.
55
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer

pkg/analyzer_cli/lib/src/analyzer_impl.dart

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,12 @@ class AnalyzerImpl {
7171
addCompilationUnitSource(unitElement, units);
7272
}
7373
// Add imported libraries.
74-
var importedLibraries = library.units
75-
.expand((unit) => unit.libraryImports)
76-
.map((export) => export.importedLibrary)
77-
.nonNulls;
74+
var importedLibraries = library.importedLibraries;
7875
for (var child in importedLibraries) {
7976
addLibrarySources(child, libraries, units);
8077
}
8178
// Add exported libraries.
82-
var exportedLibraries = library.units
83-
.expand((unit) => unit.libraryExports)
84-
.map((export) => export.exportedLibrary)
85-
.nonNulls;
79+
var exportedLibraries = library.exportedLibraries;
8680
for (var child in exportedLibraries) {
8781
addLibrarySources(child, libraries, units);
8882
}

0 commit comments

Comments
 (0)