supportsZukeAnnotationTarget function

bool supportsZukeAnnotationTarget(
  1. String annotationName,
  2. String target
)

The declaration targets supported by each public annotation. The extractor, analyzer plugin, and hook must all consult this one matrix.

Implementation

bool supportsZukeAnnotationTarget(String annotationName, String target) {
  final allowed = switch (annotationName) {
    'ImplementsRequirement' => const {
      'class',
      'mixin',
      'extensionType',
      'method',
      'function',
    },
    'PresentsRequirement' => const {'class', 'method', 'function'},
    'ProvidesControl' => const {'class', 'mixin', 'method', 'function'},
    'ZukeBinding' => const {'field', 'getter'},
    'VerifiesRequirement' => const {'method', 'function'},
    _ => const <String>{},
  };
  return allowed.contains(target);
}