Skip to content

Commit d509389

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Use a switch when examining a Deprecated annotation's kind
Change-Id: I5c2e75d022b87b87b4a0c743c1b12d404f4f5cec Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448242 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]> Auto-Submit: Samuel Rawlins <[email protected]>
1 parent 847fade commit d509389

File tree

1 file changed

+11
-30
lines changed

1 file changed

+11
-30
lines changed

pkg/analyzer/lib/src/error/annotation_verifier.dart

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -119,36 +119,17 @@ class AnnotationVerifier {
119119
var element = node.elementAnnotation;
120120
if (element == null) return;
121121
assert(element.isDeprecated);
122-
var kind = element.deprecationKind;
123-
if (kind == null) return;
124-
125-
// The vast majority of deprecated annotations use the default constructor.
126-
// Check this case first.
127-
if (kind == 'use') return;
128-
129-
if (kind == 'extend') {
130-
_checkDeprecatedExtend(node, node.parent);
131-
return;
132-
}
133-
134-
if (kind == 'implement') {
135-
_checkDeprecatedImplement(node, node.parent);
136-
return;
137-
}
138-
139-
if (kind == 'mixin') {
140-
_checkDeprecatedMixin(node, node.parent);
141-
return;
142-
}
143-
144-
if (kind == 'subclass') {
145-
_checkDeprecatedSubclass(node, node.parent);
146-
return;
147-
}
148-
149-
if (kind == 'instantiate') {
150-
_checkDeprecatedInstantiate(node, node.parent);
151-
return;
122+
switch (element.deprecationKind) {
123+
case 'extend':
124+
_checkDeprecatedExtend(node, node.parent);
125+
case 'implement':
126+
_checkDeprecatedImplement(node, node.parent);
127+
case 'instantiate':
128+
_checkDeprecatedInstantiate(node, node.parent);
129+
case 'mixin':
130+
_checkDeprecatedMixin(node, node.parent);
131+
case 'subclass':
132+
_checkDeprecatedSubclass(node, node.parent);
152133
}
153134
}
154135

0 commit comments

Comments
 (0)