@@ -49,8 +49,21 @@ import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
4949import 'package:analyzer/src/generated/source.dart' ;
5050import 'package:analyzer/src/generated/utilities_dart.dart' ;
5151import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
52+ import 'package:meta/meta.dart' ;
5253import 'package:pub_semver/pub_semver.dart' ;
5354
55+ /// A library augmentation import directive within a library.
56+ ///
57+ /// Clients may not extend, implement or mix-in this class.
58+ @experimental
59+ abstract class AugmentationImportElement implements UriReferencedElement {
60+ /// Returns the augmentation library that this element imports.
61+ LibraryAugmentationElement get augmentation;
62+
63+ @override
64+ LibraryOrAugmentationElement get enclosingElement;
65+ }
66+
5467/// An element that represents a class or a mixin. The class can be defined by
5568/// either a class declaration (with a class body), a mixin application (without
5669/// a class body), a mixin declaration, or an enum declaration.
@@ -1292,17 +1305,20 @@ abstract class LabelElement implements Element {
12921305 String get name;
12931306}
12941307
1295- /// A library.
1308+ /// A library augmentation .
12961309///
12971310/// Clients may not extend, implement or mix-in this class.
1298- abstract class LibraryElement implements _ExistingElement {
1299- /// Returns a list containing all of the extension elements accessible within
1300- /// this library.
1301- List <ExtensionElement > get accessibleExtensions;
1302-
1303- /// Return the compilation unit that defines this library.
1304- CompilationUnitElement get definingCompilationUnit;
1311+ @experimental
1312+ abstract class LibraryAugmentationElement extends LibraryOrAugmentationElement {
1313+ /// Returns the library that is augmented by this augmentation.
1314+ LibraryOrAugmentationElement get augmented ;
1315+ }
13051316
1317+ /// A library.
1318+ ///
1319+ /// Clients may not extend, implement or mix-in this class.
1320+ abstract class LibraryElement
1321+ implements LibraryOrAugmentationElement , _ExistingElement {
13061322 /// Return the entry point for this library, or `null` if this library does
13071323 /// not have an entry point. The entry point is defined to be a zero argument
13081324 /// top-level function whose name is `main` .
@@ -1315,16 +1331,6 @@ abstract class LibraryElement implements _ExistingElement {
13151331 /// The export [Namespace] of this library.
13161332 Namespace get exportNamespace;
13171333
1318- /// Return a list containing all of the exports defined in this library.
1319- List <ExportElement > get exports;
1320-
1321- /// The set of features available to this library.
1322- ///
1323- /// Determined by the combination of the language version for the enclosing
1324- /// package, enabled experiments, and the presence of a `// @dart` language
1325- /// version override comment at the top of the file.
1326- FeatureSet get featureSet;
1327-
13281334 /// Return an identifier that uniquely identifies this element among the
13291335 /// children of this element's parent.
13301336 String get identifier;
@@ -1334,9 +1340,6 @@ abstract class LibraryElement implements _ExistingElement {
13341340 /// prefix and those that are imported without a prefix.
13351341 List <LibraryElement > get importedLibraries;
13361342
1337- /// Return a list containing all of the imports defined in this library.
1338- List <ImportElement > get imports;
1339-
13401343 /// Return `true` if this library is an application that can be run in the
13411344 /// browser.
13421345 bool get isBrowserApplication;
@@ -1350,11 +1353,6 @@ abstract class LibraryElement implements _ExistingElement {
13501353 /// Return `true` if this library is part of the SDK.
13511354 bool get isInSdk;
13521355
1353- bool get isNonNullableByDefault;
1354-
1355- /// The language version for this library.
1356- LibraryLanguageVersion get languageVersion;
1357-
13581356 /// Return the element representing the synthetic function `loadLibrary` that
13591357 /// is implicitly defined for this library if the library is imported using a
13601358 /// deferred import.
@@ -1370,32 +1368,14 @@ abstract class LibraryElement implements _ExistingElement {
13701368 /// compilation unit that contains the `part` directives.
13711369 List <CompilationUnitElement > get parts;
13721370
1373- /// Return a list containing elements for each of the prefixes used to
1374- /// `import` libraries into this library. Each prefix can be used in more
1375- /// than one `import` directive.
1376- List <PrefixElement > get prefixes;
1377-
13781371 /// The public [Namespace] of this library.
13791372 Namespace get publicNamespace;
13801373
1381- /// Return the name lookup scope for this library. It consists of elements
1382- /// that are either declared in the library, or imported into it.
1383- Scope get scope;
1384-
1385- @override
1386- AnalysisSession get session;
1387-
13881374 /// Return the top-level elements defined in each of the compilation units
13891375 /// that are included in this library. This includes both public and private
13901376 /// elements, but does not include imports, exports, or synthetic elements.
13911377 Iterable <Element > get topLevelElements;
13921378
1393- /// Return the [TypeProvider] that is used in this library.
1394- TypeProvider get typeProvider;
1395-
1396- /// Return the [TypeSystem] that is used in this library.
1397- TypeSystem get typeSystem;
1398-
13991379 /// Return a list containing all of the compilation units this library
14001380 /// consists of. This includes the defining compilation unit and units
14011381 /// included using the `part` directive.
@@ -1436,6 +1416,59 @@ class LibraryLanguageVersion {
14361416 }
14371417}
14381418
1419+ /// Shared interface between [LibraryElement] and [LibraryAugmentationElement] .
1420+ ///
1421+ /// Clients may not extend, implement or mix-in this class.
1422+ @experimental
1423+ abstract class LibraryOrAugmentationElement implements Element {
1424+ /// Returns a list containing all of the extension elements accessible within
1425+ /// this library.
1426+ List <ExtensionElement > get accessibleExtensions;
1427+
1428+ /// Returns the augmentation imports specified in this library.
1429+ @experimental
1430+ List <AugmentationImportElement > get augmentationImports;
1431+
1432+ /// Return the compilation unit that defines this library.
1433+ CompilationUnitElement get definingCompilationUnit;
1434+
1435+ /// Return a list containing all of the exports defined in this library.
1436+ List <ExportElement > get exports;
1437+
1438+ /// The set of features available to this library.
1439+ ///
1440+ /// Determined by the combination of the language version for the enclosing
1441+ /// package, enabled experiments, and the presence of a `// @dart` language
1442+ /// version override comment at the top of the file.
1443+ FeatureSet get featureSet;
1444+
1445+ /// Return a list containing all of the imports defined in this library.
1446+ List <ImportElement > get imports;
1447+
1448+ bool get isNonNullableByDefault;
1449+
1450+ /// The language version for this library.
1451+ LibraryLanguageVersion get languageVersion;
1452+
1453+ /// Return a list containing elements for each of the prefixes used to
1454+ /// `import` libraries into this library. Each prefix can be used in more
1455+ /// than one `import` directive.
1456+ List <PrefixElement > get prefixes;
1457+
1458+ /// Return the name lookup scope for this library. It consists of elements
1459+ /// that are either declared in the library, or imported into it.
1460+ Scope get scope;
1461+
1462+ @override
1463+ AnalysisSession get session;
1464+
1465+ /// Return the [TypeProvider] that is used in this library.
1466+ TypeProvider get typeProvider;
1467+
1468+ /// Return the [TypeSystem] that is used in this library.
1469+ TypeSystem get typeSystem;
1470+ }
1471+
14391472/// An element that can be (but is not required to be) defined within a method
14401473/// or function (an [ExecutableElement] ).
14411474///
0 commit comments