From c9474ebaaaa2f263eddcb2ca89dfad205f684cc6 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Tue, 2 Apr 2024 17:29:29 +0000 Subject: [PATCH] meta: Introduce TargetKind.directive Fixes https://github.com/dart-lang/sdk/issues/52274 Change-Id: I67884caf86502d4edd848eb32a30097488e09db9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360480 Reviewed-by: Brian Wilkerson Commit-Queue: Samuel Rawlins --- pkg/meta/CHANGELOG.md | 2 ++ pkg/meta/lib/meta_meta.dart | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/pkg/meta/CHANGELOG.md b/pkg/meta/CHANGELOG.md index c9c846153fa..2691028656a 100644 --- a/pkg/meta/CHANGELOG.md +++ b/pkg/meta/CHANGELOG.md @@ -2,6 +2,8 @@ - Introduce `TargetKind.constructor`, to indicate that an annotation is valid on any constructor. +- Introduce `TargetKind.directive`, to indicate that an annotation is valid on + any directive. - Introduce `TargetKind.typeParamteer`, to indicate that an annotation is valid on any type parameter. - Introduce `@doNotSubmit` to annotate members that should not be submitted to diff --git a/pkg/meta/lib/meta_meta.dart b/pkg/meta/lib/meta_meta.dart index f1de463ade6..b055ba56790 100644 --- a/pkg/meta/lib/meta_meta.dart +++ b/pkg/meta/lib/meta_meta.dart @@ -48,6 +48,11 @@ class TargetKind { /// because there is no way to annotate a primary constructor. static const constructor = TargetKind._('constructors', 'constructor'); + /// Indicates that an annotation is valid on any directive in a library or + /// part file, whether it's a `library`, `import`, `export`, `part`, or + /// `part of` directive. + static const directive = TargetKind._('directives', 'directive'); + /// Indicates that an annotation is valid on any enum declaration. static const enumType = TargetKind._('enums', 'enumType'); @@ -119,6 +124,7 @@ class TargetKind { static const values = [ classType, constructor, + directive, enumType, extension, extensionType,