@@ -42,6 +42,12 @@ class TargetKind {
42
42
/// Indicates that an annotation is valid on any class declaration.
43
43
static const classType = TargetKind ._('classes' , 'classType' );
44
44
45
+ /// Indicates that an annotation is valid on any constructor declaration, both
46
+ /// factory and generative constructors, whether it's in a class, enum, or
47
+ /// extension type. Extension type primary constructors are not supported,
48
+ /// because there is no way to annotate a primary constructor.
49
+ static const constructor = TargetKind ._('constructors' , 'constructor' );
50
+
45
51
/// Indicates that an annotation is valid on any enum declaration.
46
52
static const enumType = TargetKind ._('enums' , 'enumType' );
47
53
@@ -52,7 +58,8 @@ class TargetKind {
52
58
static const extensionType = TargetKind ._('extension types' , 'extensionType' );
53
59
54
60
/// Indicates that an annotation is valid on any field declaration, both
55
- /// instance and static fields, whether it's in a class, mixin or extension.
61
+ /// instance and static fields, whether it's in a class, enum, mixin, or
62
+ /// extension.
56
63
static const field = TargetKind ._('fields' , 'field' );
57
64
58
65
/// Indicates that an annotation is valid on any top-level function
@@ -65,24 +72,26 @@ class TargetKind {
65
72
static const library = TargetKind ._('libraries' , 'library' );
66
73
67
74
/// Indicates that an annotation is valid on any getter declaration, both
68
- /// instance or static getters, whether it's in a class, mixin, extension, or
69
- /// at the top-level of a library.
75
+ /// instance or static getters, whether it's in a class, enum, mixin,
76
+ /// extension, extension type, or at the top-level of a library.
70
77
static const getter = TargetKind ._('getters' , 'getter' );
71
78
72
79
/// Indicates that an annotation is valid on any method declaration, both
73
- /// instance and static methods, whether it's in a class, mixin or extension.
80
+ /// instance and static methods, whether it's in a class, enum, mixin,
81
+ /// extension, or extension type.
74
82
static const method = TargetKind ._('methods' , 'method' );
75
83
76
84
/// Indicates that an annotation is valid on any mixin declaration.
77
85
static const mixinType = TargetKind ._('mixins' , 'mixinType' );
78
86
79
87
/// Indicates that an annotation is valid on any formal parameter declaration,
80
- /// whether it's in a function (named or anonymous), method, or constructor.
88
+ /// whether it's in a constructor, function (named or anonymous), function
89
+ /// type, function-typed formal parameter, or method.
81
90
static const parameter = TargetKind ._('parameters' , 'parameter' );
82
91
83
92
/// Indicates that an annotation is valid on any setter declaration, both
84
- /// instance or static setters, whether it's in a class, mixin, extension, or
85
- /// at the top-level of a library.
93
+ /// instance or static setters, whether it's in a class, enum, mixin,
94
+ /// extension, extension type, or at the top-level of a library.
86
95
static const setter = TargetKind ._('setters' , 'setter' );
87
96
88
97
/// Indicates that an annotation is valid on any top-level variable
@@ -91,24 +100,25 @@ class TargetKind {
91
100
TargetKind ._('top-level variables' , 'topLevelVariable' );
92
101
93
102
/// Indicates that an annotation is valid on any declaration that introduces a
94
- /// type. This includes classes, enums, mixins and typedefs, but does not
103
+ /// type. This includes classes, enums, mixins, and typedefs, but does not
95
104
/// include extensions because extensions don't introduce a type.
105
+ // TODO(srawlins): This should include extension types.
96
106
static const type =
97
107
TargetKind ._('types (classes, enums, mixins, or typedefs)' , 'type' );
98
108
99
- /// Indicates that an annotation is valid on any typedef declaration.`
109
+ /// Indicates that an annotation is valid on any typedef declaration.
100
110
static const typedefType = TargetKind ._('typedefs' , 'typedefType' );
101
111
102
112
/// Indicates that an annotation is valid on any type parameter declaration,
103
113
/// whether it's on a class, enum, function type, function, mixin, extension,
104
114
/// extension type, or typedef.
105
- static const typeParameter = TargetKind ._(
106
- 'type parameters (classes, enums, mixins, or typedefs)' , 'typeParameter' );
115
+ static const typeParameter = TargetKind ._('type parameters' , 'typeParameter' );
107
116
108
117
/// All current [TargetKind] values of targets to
109
118
/// which an annotation can be applied.
110
119
static const values = [
111
120
classType,
121
+ constructor,
112
122
enumType,
113
123
extension ,
114
124
extensionType,
@@ -122,8 +132,8 @@ class TargetKind {
122
132
setter,
123
133
topLevelVariable,
124
134
type,
125
- typeParameter,
126
135
typedefType,
136
+ typeParameter,
127
137
];
128
138
129
139
/// A user visible string used to describe this target kind.
0 commit comments