Skip to content

Commit be5235b

Browse files
pqCommit Queue
authored andcommitted
[element model] make _Annotatable public
Change-Id: I28edc8d761efad2618ea4528c18fdf5f016facb4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389261 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 843a178 commit be5235b

File tree

1 file changed

+133
-133
lines changed

1 file changed

+133
-133
lines changed

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

Lines changed: 133 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,129 @@ export 'package:analyzer/dart/element/element.dart'
7777
ElementAnnotation,
7878
ElementKind;
7979

80+
/// An element or fragment that can have either annotations (metadata), a
81+
/// documentation comment, or both associated with it.
82+
abstract class Annotatable {
83+
/// The content of the documentation comment (including delimiters) for this
84+
/// element or fragment.
85+
///
86+
/// If the receiver is an element that has fragments, the comment will be a
87+
/// concatenation of the comments from all of the fragments.
88+
///
89+
/// Returns `null` if the receiver doesn't have documentation.
90+
String? get documentationComment;
91+
92+
/// Whether the receiver has an annotation of the form `@alwaysThrows`.
93+
bool get hasAlwaysThrows;
94+
95+
/// Whether the receiver has an annotation of the form `@deprecated`
96+
/// or `@Deprecated('..')`.
97+
bool get hasDeprecated;
98+
99+
/// Whether the receiver has an annotation of the form `@doNotStore`.
100+
bool get hasDoNotStore;
101+
102+
/// Whether the receiver has an annotation of the form `@doNotSubmit`.
103+
bool get hasDoNotSubmit;
104+
105+
/// Whether the receiver has an annotation of the form `@factory`.
106+
bool get hasFactory;
107+
108+
/// Whether the receiver has an annotation of the form `@immutable`.
109+
bool get hasImmutable;
110+
111+
/// Whether the receiver has an annotation of the form `@internal`.
112+
bool get hasInternal;
113+
114+
/// Whether the receiver has an annotation of the form `@isTest`.
115+
bool get hasIsTest;
116+
117+
/// Whether the receiver has an annotation of the form `@isTestGroup`.
118+
bool get hasIsTestGroup;
119+
120+
/// Whether the receiver has an annotation of the form `@JS(..)`.
121+
bool get hasJS;
122+
123+
/// Whether the receiver has an annotation of the form `@literal`.
124+
bool get hasLiteral;
125+
126+
/// Whether the receiver has an annotation of the form `@mustBeConst`.
127+
bool get hasMustBeConst;
128+
129+
/// Whether the receiver has an annotation of the form `@mustBeOverridden`.
130+
bool get hasMustBeOverridden;
131+
132+
/// Whether the receiver has an annotation of the form `@mustCallSuper`.
133+
bool get hasMustCallSuper;
134+
135+
/// Whether the receiver has an annotation of the form `@nonVirtual`.
136+
bool get hasNonVirtual;
137+
138+
/// Whether the receiver has an annotation of the form `@optionalTypeArgs`.
139+
bool get hasOptionalTypeArgs;
140+
141+
/// Whether the receiver has an annotation of the form `@override`.
142+
bool get hasOverride;
143+
144+
/// Whether the receiver has an annotation of the form `@protected`.
145+
bool get hasProtected;
146+
147+
/// Whether the receiver has an annotation of the form `@redeclare`.
148+
bool get hasRedeclare;
149+
150+
/// Whether the receiver has an annotation of the form `@reopen`.
151+
bool get hasReopen;
152+
153+
/// Whether the receiver has an annotation of the form `@required`.
154+
bool get hasRequired;
155+
156+
/// Whether the receiver has an annotation of the form `@sealed`.
157+
bool get hasSealed;
158+
159+
/// Whether the receiver has an annotation of the form `@useResult`
160+
/// or `@UseResult('..')`.
161+
bool get hasUseResult;
162+
163+
/// Whether the receiver has an annotation of the form `@visibleForOverriding`.
164+
bool get hasVisibleForOverriding;
165+
166+
/// Whether the receiver has an annotation of the form `@visibleForTemplate`.
167+
bool get hasVisibleForTemplate;
168+
169+
/// Whether the receiver has an annotation of the form `@visibleForTesting`.
170+
bool get hasVisibleForTesting;
171+
172+
/// Whether the receiver has an annotation of the form
173+
/// `@visibleOutsideTemplate`.
174+
bool get hasVisibleOutsideTemplate;
175+
176+
/// The metadata associated with the element or fragment.
177+
///
178+
/// If the receiver is an element that has fragments, the list will include
179+
/// all of the metadata from all of the fragments.
180+
///
181+
/// The list will be empty if the receiver does not have any metadata or if
182+
/// the library containing this element has not yet been fully resolved.
183+
List<ElementAnnotation> get metadata;
184+
185+
/// The version where this SDK API was added.
186+
///
187+
/// A `@Since()` annotation can be applied to a library declaration,
188+
/// any public declaration in a library, or in a class, or to an optional
189+
/// parameter, etc.
190+
///
191+
/// The returned version is "effective", so that if a library is annotated
192+
/// then all elements of the library inherit it; or if a class is annotated
193+
/// then all members and constructors of the class inherit it.
194+
///
195+
/// If multiple `@Since()` annotations apply to the same element, the latest
196+
/// version takes precedence.
197+
///
198+
/// Returns `null` if the element is not declared in the SDK, or doesn't have
199+
/// a `@Since()` annotation applied to it.
200+
Version? get sinceSdkVersion;
201+
}
202+
80203
abstract class BindPatternVariableElement2 implements PatternVariableElement2 {}
81204

82205
/// A class.
@@ -612,7 +735,7 @@ abstract class FieldFragment implements PropertyInducingFragment {
612735
///
613736
/// Clients may not extend, implement or mix-in this class.
614737
abstract class FormalParameterElement
615-
implements PromotableElement2, _Annotatable, FragmentedElement {
738+
implements PromotableElement2, Annotatable, FragmentedElement {
616739
@override
617740
FormalParameterElement get baseElement;
618741

@@ -708,7 +831,7 @@ abstract class FormalParameterElement
708831
///
709832
/// Clients may not extend, implement, or mix-in this class.
710833
abstract class FormalParameterFragment
711-
implements PromotableFragment, _Annotatable {
834+
implements PromotableFragment, Annotatable {
712835
@override
713836
FormalParameterElement get element;
714837

@@ -1086,7 +1209,7 @@ abstract class LabelElement2 implements Element2 {
10861209
///
10871210
/// Clients may not extend, implement or mix-in this class.
10881211
abstract class LibraryElement2
1089-
implements Element2, _Annotatable, FragmentedElement {
1212+
implements Element2, Annotatable, FragmentedElement {
10901213
/// The classes defined in this library.
10911214
///
10921215
/// There is no guarantee of the order in which the classes will be returned.
@@ -1240,7 +1363,7 @@ abstract class LibraryExport {
12401363
}
12411364

12421365
/// The portion of a [LibraryElement2] coming from a single compilation unit.
1243-
abstract class LibraryFragment implements Fragment, _Annotatable {
1366+
abstract class LibraryFragment implements Fragment, Annotatable {
12441367
/// The extension elements accessible within this fragment.
12451368
List<ExtensionElement2> get accessibleExtensions2;
12461369

@@ -1594,7 +1717,7 @@ abstract class PromotableFragment implements VariableFragment {
15941717
///
15951718
/// Clients may not extend, implement or mix-in this class.
15961719
abstract class PropertyInducingElement2
1597-
implements VariableElement2, _Annotatable, FragmentedElement {
1720+
implements VariableElement2, Annotatable, FragmentedElement {
15981721
@override
15991722
PropertyInducingFragment? get firstFragment;
16001723

@@ -1625,7 +1748,7 @@ abstract class PropertyInducingElement2
16251748
///
16261749
/// Clients may not extend, implement or mix-in this class.
16271750
abstract class PropertyInducingFragment
1628-
implements VariableFragment, _Annotatable {
1751+
implements VariableFragment, Annotatable {
16291752
@override
16301753
PropertyInducingElement2 get element;
16311754

@@ -1886,15 +2009,15 @@ abstract class TypeAliasFragment
18862009
///
18872010
/// Clients may not extend, implement or mix-in this class.
18882011
abstract class TypeDefiningElement2
1889-
implements Element2, _Annotatable, FragmentedElement {
2012+
implements Element2, Annotatable, FragmentedElement {
18902013
// TODO(brianwilkerson): Evaluate to see whether this type is actually needed
18912014
// after converting clients to the new API.
18922015
}
18932016

18942017
/// The portion of a [TypeDefiningElement2] contributed by a single declaration.
18952018
///
18962019
/// Clients may not extend, implement or mix-in this class.
1897-
abstract class TypeDefiningFragment implements Fragment, _Annotatable {
2020+
abstract class TypeDefiningFragment implements Fragment, Annotatable {
18982021
@override
18992022
TypeDefiningElement2 get element;
19002023
}
@@ -1950,7 +2073,7 @@ abstract class TypeParameterFragment implements TypeDefiningFragment {
19502073
/// An element that has type parameters, such as a class, typedef, or method.
19512074
///
19522075
/// Clients may not extend, implement or mix-in this class.
1953-
abstract class TypeParameterizedElement2 implements Element2, _Annotatable {
2076+
abstract class TypeParameterizedElement2 implements Element2, Annotatable {
19542077
/// If the element defines a type, indicates whether the type may safely
19552078
/// appear without explicit type arguments as the bounds of a type parameter
19562079
/// declaration.
@@ -1969,7 +2092,7 @@ abstract class TypeParameterizedElement2 implements Element2, _Annotatable {
19692092
/// declaration.
19702093
///
19712094
/// Clients may not extend, implement or mix-in this class.
1972-
abstract class TypeParameterizedFragment implements Fragment, _Annotatable {
2095+
abstract class TypeParameterizedFragment implements Fragment, Annotatable {
19732096
@override
19742097
TypeParameterizedElement2 get element;
19752098

@@ -2052,126 +2175,3 @@ abstract class VariableFragment implements Fragment {
20522175
/// even though they are implicitly final.
20532176
bool get isFinal;
20542177
}
2055-
2056-
/// An element or fragment that can have either annotations (metadata), a
2057-
/// documentation comment, or both associated with it.
2058-
abstract class _Annotatable {
2059-
/// The content of the documentation comment (including delimiters) for this
2060-
/// element or fragment.
2061-
///
2062-
/// If the receiver is an element that has fragments, the comment will be a
2063-
/// concatenation of the comments from all of the fragments.
2064-
///
2065-
/// Returns `null` if the receiver doesn't have documentation.
2066-
String? get documentationComment;
2067-
2068-
/// Whether the receiver has an annotation of the form `@alwaysThrows`.
2069-
bool get hasAlwaysThrows;
2070-
2071-
/// Whether the receiver has an annotation of the form `@deprecated`
2072-
/// or `@Deprecated('..')`.
2073-
bool get hasDeprecated;
2074-
2075-
/// Whether the receiver has an annotation of the form `@doNotStore`.
2076-
bool get hasDoNotStore;
2077-
2078-
/// Whether the receiver has an annotation of the form `@doNotSubmit`.
2079-
bool get hasDoNotSubmit;
2080-
2081-
/// Whether the receiver has an annotation of the form `@factory`.
2082-
bool get hasFactory;
2083-
2084-
/// Whether the receiver has an annotation of the form `@immutable`.
2085-
bool get hasImmutable;
2086-
2087-
/// Whether the receiver has an annotation of the form `@internal`.
2088-
bool get hasInternal;
2089-
2090-
/// Whether the receiver has an annotation of the form `@isTest`.
2091-
bool get hasIsTest;
2092-
2093-
/// Whether the receiver has an annotation of the form `@isTestGroup`.
2094-
bool get hasIsTestGroup;
2095-
2096-
/// Whether the receiver has an annotation of the form `@JS(..)`.
2097-
bool get hasJS;
2098-
2099-
/// Whether the receiver has an annotation of the form `@literal`.
2100-
bool get hasLiteral;
2101-
2102-
/// Whether the receiver has an annotation of the form `@mustBeConst`.
2103-
bool get hasMustBeConst;
2104-
2105-
/// Whether the receiver has an annotation of the form `@mustBeOverridden`.
2106-
bool get hasMustBeOverridden;
2107-
2108-
/// Whether the receiver has an annotation of the form `@mustCallSuper`.
2109-
bool get hasMustCallSuper;
2110-
2111-
/// Whether the receiver has an annotation of the form `@nonVirtual`.
2112-
bool get hasNonVirtual;
2113-
2114-
/// Whether the receiver has an annotation of the form `@optionalTypeArgs`.
2115-
bool get hasOptionalTypeArgs;
2116-
2117-
/// Whether the receiver has an annotation of the form `@override`.
2118-
bool get hasOverride;
2119-
2120-
/// Whether the receiver has an annotation of the form `@protected`.
2121-
bool get hasProtected;
2122-
2123-
/// Whether the receiver has an annotation of the form `@redeclare`.
2124-
bool get hasRedeclare;
2125-
2126-
/// Whether the receiver has an annotation of the form `@reopen`.
2127-
bool get hasReopen;
2128-
2129-
/// Whether the receiver has an annotation of the form `@required`.
2130-
bool get hasRequired;
2131-
2132-
/// Whether the receiver has an annotation of the form `@sealed`.
2133-
bool get hasSealed;
2134-
2135-
/// Whether the receiver has an annotation of the form `@useResult`
2136-
/// or `@UseResult('..')`.
2137-
bool get hasUseResult;
2138-
2139-
/// Whether the receiver has an annotation of the form `@visibleForOverriding`.
2140-
bool get hasVisibleForOverriding;
2141-
2142-
/// Whether the receiver has an annotation of the form `@visibleForTemplate`.
2143-
bool get hasVisibleForTemplate;
2144-
2145-
/// Whether the receiver has an annotation of the form `@visibleForTesting`.
2146-
bool get hasVisibleForTesting;
2147-
2148-
/// Whether the receiver has an annotation of the form
2149-
/// `@visibleOutsideTemplate`.
2150-
bool get hasVisibleOutsideTemplate;
2151-
2152-
/// The metadata associated with the element or fragment.
2153-
///
2154-
/// If the receiver is an element that has fragments, the list will include
2155-
/// all of the metadata from all of the fragments.
2156-
///
2157-
/// The list will be empty if the receiver does not have any metadata or if
2158-
/// the library containing this element has not yet been fully resolved.
2159-
List<ElementAnnotation> get metadata;
2160-
2161-
/// The version where this SDK API was added.
2162-
///
2163-
/// A `@Since()` annotation can be applied to a library declaration,
2164-
/// any public declaration in a library, or in a class, or to an optional
2165-
/// parameter, etc.
2166-
///
2167-
/// The returned version is "effective", so that if a library is annotated
2168-
/// then all elements of the library inherit it; or if a class is annotated
2169-
/// then all members and constructors of the class inherit it.
2170-
///
2171-
/// If multiple `@Since()` annotations apply to the same element, the latest
2172-
/// version takes precedence.
2173-
///
2174-
/// Returns `null` if the element is not declared in the SDK, or doesn't have
2175-
/// a `@Since()` annotation applied to it.
2176-
Version? get sinceSdkVersion;
2177-
}

0 commit comments

Comments
 (0)