File tree Expand file tree Collapse file tree 3 files changed +298
-237
lines changed Expand file tree Collapse file tree 3 files changed +298
-237
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,32 @@ extension DartTypeExtension on DartType {
2222}
2323
2424extension Element2Extension on Element2 {
25+ /// Return `true` if this element, the enclosing class (if there is one), or
26+ /// the enclosing library, has been annotated with the `@doNotStore`
27+ /// annotation.
28+ bool get hasOrInheritsDoNotStore {
29+ if (this case Annotatable annotatable) {
30+ if (annotatable.metadata2.hasDoNotStore) {
31+ return true ;
32+ }
33+ }
34+
35+ var ancestor = enclosingElement2;
36+ if (ancestor is InterfaceElement2 ) {
37+ if (ancestor.metadata2.hasDoNotStore) {
38+ return true ;
39+ }
40+ ancestor = ancestor.enclosingElement2;
41+ } else if (ancestor is ExtensionElement2 ) {
42+ if (ancestor.metadata2.hasDoNotStore) {
43+ return true ;
44+ }
45+ ancestor = ancestor.enclosingElement2;
46+ }
47+
48+ return ancestor is LibraryElement2 && ancestor.metadata2.hasDoNotStore;
49+ }
50+
2551 /// Return `true` if this element is an instance member of a class or mixin.
2652 ///
2753 /// Only [MethodElement2] s, [GetterElement] s, and [SetterElement] s are
Original file line number Diff line number Diff line change @@ -180,6 +180,23 @@ class NamespaceBuilder {
180180 return Namespace (exportedNames);
181181 }
182182
183+ /// Create a namespace representing the export namespace of the given
184+ /// [export] .
185+ Namespace createExportNamespaceForDirective2 (LibraryExport export) {
186+ var exportedLibrary = export.exportedLibrary2;
187+ if (exportedLibrary == null ) {
188+ //
189+ // The exported library will be null if the URI does not reference a valid
190+ // library.
191+ //
192+ return Namespace .EMPTY ;
193+ }
194+ Map <String , Element > exportedNames =
195+ _getExportMapping (exportedLibrary.asElement);
196+ exportedNames = _applyCombinators (exportedNames, export.combinators);
197+ return Namespace (exportedNames);
198+ }
199+
183200 /// Create a namespace representing the export namespace of the given
184201 /// [library] .
185202 Namespace createExportNamespaceForLibrary (LibraryElement2 library) {
You can’t perform that action at this time.
0 commit comments