@@ -688,10 +688,7 @@ abstract class ClassOrMixinElementImpl extends InterfaceElementImpl {
688688
689689/// A concrete implementation of [LibraryFragment] .
690690class CompilationUnitElementImpl extends UriReferencedElementImpl
691- implements
692- // ignore:deprecated_member_use_from_same_package,analyzer_use_new_elements
693- CompilationUnitElement ,
694- LibraryFragment {
691+ implements LibraryFragment {
695692 /// The source that corresponds to this compilation unit.
696693 @override
697694 final Source source;
@@ -914,7 +911,7 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
914911 @override
915912 ElementKind get kind => ElementKind .COMPILATION_UNIT ;
916913
917- @override
914+ /// The libraries exported by this unit.
918915 List <LibraryExportElementImpl > get libraryExports {
919916 linkedData? .read (this );
920917 return _libraryExports;
@@ -938,12 +935,14 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
938935 @override
939936 LibraryFragment get libraryFragment => this ;
940937
941- @override
938+ /// The prefixes used by [libraryImports] .
939+ ///
940+ /// Each prefix can be used in more than one `import` directive.
942941 List <PrefixElementImpl > get libraryImportPrefixes {
943942 return _libraryImportPrefixes ?? = _buildLibraryImportPrefixes ();
944943 }
945944
946- @override
945+ /// The libraries imported by this unit.
947946 List <LibraryImportElementImpl > get libraryImports {
948947 linkedData? .read (this );
949948 return _libraryImports;
@@ -1018,15 +1017,15 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
10181017 @override
10191018 List <PartInclude > get partIncludes => parts.cast <PartInclude >();
10201019
1021- @override
1020+ /// The parts included by this unit.
10221021 List <PartElementImpl > get parts => _parts;
10231022
10241023 set parts (List <PartElementImpl > parts) {
10251024 for (var part in parts) {
10261025 part.enclosingElement3 = this ;
10271026 var uri = part.uri;
10281027 if (uri is DirectiveUriWithUnitImpl ) {
1029- uri.unit .enclosingElement3 = this ;
1028+ uri.libraryFragment .enclosingElement3 = this ;
10301029 }
10311030 }
10321031 _parts = parts;
@@ -1907,19 +1906,16 @@ class DirectiveUriWithSourceImpl extends DirectiveUriWithRelativeUriImpl
19071906class DirectiveUriWithUnitImpl extends DirectiveUriWithRelativeUriImpl
19081907 implements DirectiveUriWithUnit {
19091908 @override
1910- final CompilationUnitElementImpl unit ;
1909+ final CompilationUnitElementImpl libraryFragment ;
19111910
19121911 DirectiveUriWithUnitImpl ({
19131912 required super .relativeUriString,
19141913 required super .relativeUri,
1915- required this .unit ,
1914+ required this .libraryFragment ,
19161915 });
19171916
19181917 @override
1919- CompilationUnitElementImpl get libraryFragment => unit;
1920-
1921- @override
1922- Source get source => unit.source;
1918+ Source get source => libraryFragment.source;
19231919}
19241920
19251921/// The synthetic element representing the declaration of the type `dynamic` .
@@ -6568,7 +6564,7 @@ class LibraryElementImpl extends ElementImpl
65686564 AnalysisSessionImpl session;
65696565
65706566 /// The compilation unit that defines this library.
6571- late CompilationUnitElementImpl _definingCompilationUnit ;
6567+ late CompilationUnitElementImpl definingCompilationUnit ;
65726568
65736569 /// The language version for the library.
65746570 LibraryLanguageVersion ? _languageVersion;
@@ -6672,16 +6668,6 @@ class LibraryElementImpl extends ElementImpl
66726668 ];
66736669 }
66746670
6675- @override
6676- CompilationUnitElementImpl get definingCompilationUnit =>
6677- _definingCompilationUnit;
6678-
6679- /// Set the compilation unit that defines this library to the given
6680- /// compilation[unit] .
6681- set definingCompilationUnit (CompilationUnitElementImpl unit) {
6682- _definingCompilationUnit = unit;
6683- }
6684-
66856671 @override
66866672 Null get enclosingElement2 => null ;
66876673
@@ -6690,7 +6676,7 @@ class LibraryElementImpl extends ElementImpl
66906676
66916677 @override
66926678 CompilationUnitElementImpl get enclosingUnit {
6693- return _definingCompilationUnit ;
6679+ return definingCompilationUnit ;
66946680 }
66956681
66966682 @override
@@ -6765,7 +6751,7 @@ class LibraryElementImpl extends ElementImpl
67656751 @override
67666752 List <CompilationUnitElementImpl > get fragments {
67676753 return [
6768- _definingCompilationUnit ,
6754+ definingCompilationUnit ,
67696755 ..._partUnits,
67706756 ];
67716757 }
@@ -6790,7 +6776,7 @@ class LibraryElementImpl extends ElementImpl
67906776 }
67916777
67926778 @override
6793- String get identifier => '${_definingCompilationUnit .source .uri }' ;
6779+ String get identifier => '${definingCompilationUnit .source .uri }' ;
67946780
67956781 @override
67966782 List <LibraryElementImpl > get importedLibraries {
@@ -6890,7 +6876,7 @@ class LibraryElementImpl extends ElementImpl
68906876
68916877 @override
68926878 Source get source {
6893- return _definingCompilationUnit .source;
6879+ return definingCompilationUnit .source;
68946880 }
68956881
68966882 @override
@@ -6908,10 +6894,13 @@ class LibraryElementImpl extends ElementImpl
69086894 }
69096895 }
69106896
6911- @override
6897+ /// The compilation units this library consists of.
6898+ ///
6899+ /// This includes the defining compilation unit and units included using the
6900+ /// `part` directive.
69126901 List <CompilationUnitElementImpl > get units {
69136902 return [
6914- _definingCompilationUnit ,
6903+ definingCompilationUnit ,
69156904 ..._partUnits,
69166905 ];
69176906 }
@@ -6925,7 +6914,7 @@ class LibraryElementImpl extends ElementImpl
69256914 void visitParts (CompilationUnitElementImpl unit) {
69266915 for (var part in unit.parts) {
69276916 if (part.uri case DirectiveUriWithUnitImpl uri) {
6928- var unit = uri.unit ;
6917+ var unit = uri.libraryFragment ;
69296918 result.add (unit);
69306919 visitParts (unit);
69316920 }
0 commit comments