annotationWhere<T extends Element> function
AnnotationInformation<T> ?
annotationWhere<T extends Element>(
- T element,
- bool test(
- ElementAnnotation
- ComponentVisitorExceptionHandler exceptionHandler
Returns the AnnotationInformation for the first annotation on element
that matches test
or null if no such annotation exists.
Implementation
AnnotationInformation<T>? annotationWhere<T extends Element>(
T element,
bool Function(ElementAnnotation) test,
ComponentVisitorExceptionHandler exceptionHandler) {
for (var annotationIndex = 0;
annotationIndex < element.metadata.length;
annotationIndex++) {
final annotation = element.metadata[annotationIndex];
final annotationInfo = AnnotationInformation(
element, annotation, annotationIndex, exceptionHandler);
if (annotationInfo.constantValue == null) {
exceptionHandler.handleWarning(AngularAnalysisError(
annotationInfo.constantEvaluationErrors, annotationInfo));
} else if (test(annotationInfo.annotation)) {
return annotationInfo;
}
}
return null;
}