@@ -14,10 +14,6 @@ abstract class TypeAnnotation {
1414
1515 /// A [Code] object representation of this type annotation.
1616 Code get code;
17-
18- /// Allows you to check the kind of a [TypeAnnotation] in a switch statement,
19- /// and without `is` checks.
20- TypeAnnotationKind get kind;
2117}
2218
2319/// The base class for function type declarations.
@@ -33,9 +29,6 @@ abstract class FunctionTypeAnnotation implements TypeAnnotation {
3329
3430 /// The type parameters for this function.
3531 Iterable <TypeParameterDeclaration > get typeParameters;
36-
37- @override
38- TypeAnnotationKind get kind => TypeAnnotationKind .functionType;
3932}
4033
4134/// An unresolved reference to a type.
@@ -48,9 +41,6 @@ abstract class NamedTypeAnnotation implements TypeAnnotation {
4841
4942 /// The type arguments, if applicable.
5043 Iterable <TypeAnnotation > get typeArguments;
51-
52- @override
53- TypeAnnotationKind get kind => TypeAnnotationKind .namedType;
5444}
5545
5646/// The interface representing a resolved type.
@@ -75,10 +65,6 @@ abstract class NamedStaticType implements StaticType {
7565abstract class Declaration {
7666 /// The name of this declaration.
7767 String get name;
78-
79- /// Allows you to check the kind of a [Declaration] in a switch statement,
80- /// and without `is` checks.
81- DeclarationKind get kind;
8268}
8369
8470/// A declaration that defines a new type in the program.
@@ -105,9 +91,6 @@ abstract class TypeDeclaration implements Declaration {
10591/// Information about fields, methods, and constructors must be retrieved from
10692/// the `builder` objects.
10793abstract class ClassDeclaration implements TypeDeclaration {
108- @override
109- DeclarationKind get kind => DeclarationKind .clazz;
110-
11194 /// Whether this class has an `abstract` modifier.
11295 bool get isAbstract;
11396
@@ -129,18 +112,12 @@ abstract class ClassDeclaration implements TypeDeclaration {
129112
130113/// Type alias introspection information.
131114abstract class TypeAliasDeclaration extends TypeDeclaration {
132- @override
133- DeclarationKind get kind => DeclarationKind .typeAlias;
134-
135115 /// The type annotation this is an alias for.
136116 TypeAnnotation get type;
137117}
138118
139119/// Function introspection information.
140120abstract class FunctionDeclaration implements Declaration {
141- @override
142- DeclarationKind get kind => DeclarationKind .function;
143-
144121 /// Whether this function has an `abstract` modifier.
145122 bool get isAbstract;
146123
@@ -168,9 +145,6 @@ abstract class FunctionDeclaration implements Declaration {
168145
169146/// Method introspection information.
170147abstract class MethodDeclaration implements FunctionDeclaration {
171- @override
172- DeclarationKind get kind => DeclarationKind .method;
173-
174148 /// The class that defines this method.
175149 TypeAnnotation get definingClass;
176150}
@@ -183,9 +157,6 @@ abstract class ConstructorDeclaration implements MethodDeclaration {
183157
184158/// Variable introspection information.
185159abstract class VariableDeclaration implements Declaration {
186- @override
187- DeclarationKind get kind => DeclarationKind .variable;
188-
189160 /// Whether this function has an `abstract` modifier.
190161 bool get isAbstract;
191162
@@ -201,18 +172,12 @@ abstract class VariableDeclaration implements Declaration {
201172
202173/// Field introspection information ..
203174abstract class FieldDeclaration implements VariableDeclaration {
204- @override
205- DeclarationKind get kind => DeclarationKind .field;
206-
207175 /// The class that defines this method.
208176 TypeAnnotation get definingClass;
209177}
210178
211179/// Parameter introspection information.
212180abstract class ParameterDeclaration implements Declaration {
213- @override
214- DeclarationKind get kind => DeclarationKind .parameter;
215-
216181 /// The type of this parameter.
217182 TypeAnnotation get type;
218183
@@ -230,28 +195,6 @@ abstract class ParameterDeclaration implements Declaration {
230195
231196/// Type parameter introspection information.
232197abstract class TypeParameterDeclaration implements Declaration {
233- @override
234- DeclarationKind get kind => DeclarationKind .typeParameter;
235-
236198 /// The bounds for this type parameter, if it has any.
237199 TypeAnnotation ? get bounds;
238200}
239-
240- // The kinds of type declarations.
241- enum DeclarationKind {
242- clazz,
243- constructor,
244- field,
245- function,
246- method,
247- parameter,
248- typeAlias,
249- typeParameter,
250- variable,
251- }
252-
253- // The kinds of type annotations.
254- enum TypeAnnotationKind {
255- namedType,
256- functionType,
257- }
0 commit comments