mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:27:39 +00:00
Move the check for INVALID_SEALED to the BestPracticesVerifier
Change-Id: I974196f7cd1c2b7c24df1d759774faed9f8a2581 Reviewed-on: https://dart-review.googlesource.com/c/87705 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
ac506a9d92
commit
f69aabdb62
|
@ -96,13 +96,6 @@ class ConstantVerifier extends RecursiveAstVisitor<void> {
|
|||
// arguments should be constants
|
||||
_validateConstantArguments(argumentList);
|
||||
}
|
||||
if (node.elementAnnotation?.isSealed == true &&
|
||||
!(node.parent is ClassDeclaration ||
|
||||
node.parent is ClassTypeAlias ||
|
||||
node.parent is MixinDeclaration)) {
|
||||
_errorReporter.reportErrorForNode(
|
||||
HintCode.INVALID_SEALED_ANNOTATION, node.parent, [node.element.name]);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -298,8 +298,8 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
|
|||
void visitAnnotation(Annotation node) {
|
||||
ElementAnnotation element =
|
||||
resolutionMap.elementAnnotationForAnnotation(node);
|
||||
AstNode parent = node.parent;
|
||||
if (element?.isFactory == true) {
|
||||
AstNode parent = node.parent;
|
||||
if (parent is MethodDeclaration) {
|
||||
_checkForInvalidFactory(parent);
|
||||
} else {
|
||||
|
@ -313,6 +313,13 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
|
|||
HintCode.INVALID_IMMUTABLE_ANNOTATION, node, []);
|
||||
}
|
||||
}
|
||||
if (node.elementAnnotation?.isSealed == true &&
|
||||
!(parent is ClassDeclaration ||
|
||||
parent is ClassTypeAlias ||
|
||||
parent is MixinDeclaration)) {
|
||||
_errorReporter.reportErrorForNode(
|
||||
HintCode.INVALID_SEALED_ANNOTATION, node.parent, [node.element.name]);
|
||||
}
|
||||
super.visitAnnotation(node);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue