@@ -403,7 +403,7 @@ abstract class ModelElement extends Canonicalization
403403 // akin to source_gen's Reviver, in order to link to inner components. For
404404 // example, in `@Foo(const Bar(), baz: <Baz>[Baz.one, Baz.two])`, link to
405405 // `Foo`, `Bar`, `Baz`, `Baz.one`, and `Baz.two`.
406- List <String > annotationsFromMetadata (List <ElementAnnotation > md) {
406+ List <String > annotationsFromMetadata (Iterable <ElementAnnotation > md) {
407407 var annotationStrings = < String > [];
408408 if (md == null ) return annotationStrings;
409409 for (var a in md) {
@@ -522,21 +522,24 @@ abstract class ModelElement extends Canonicalization
522522 .split (locationSplitter)
523523 .where ((s) => s.isNotEmpty));
524524
525- Set <String > get features {
526- var allFeatures = < String > {...annotations};
527-
525+ static final Set <String > _specialFeatures = {
528526 // Replace the @override annotation with a feature that explicitly
529527 // indicates whether an override has occurred.
530- allFeatures.remove ('@override' );
531-
528+ 'override' ,
532529 // Drop the plain "deprecated" annotation; that's indicated via
533530 // strikethroughs. Custom @Deprecated() will still appear.
534- allFeatures.remove ('@deprecated' );
535- // const and static are not needed here because const/static elements get
536- // their own sections in the doc.
537- if (isFinal) allFeatures.add ('final' );
538- if (isLate) allFeatures.add ('late' );
539- return allFeatures;
531+ 'deprecated'
532+ };
533+
534+ Set <String > get features {
535+ return {
536+ ...annotationsFromMetadata (element.metadata
537+ .where ((e) => ! _specialFeatures.contains (e.element? .name))),
538+ // 'const' and 'static' are not needed here because 'const' and 'static'
539+ // elements get their own sections in the doc.
540+ if (isFinal) 'final' ,
541+ if (isLate) 'late' ,
542+ };
540543 }
541544
542545 String get featuresAsString {
0 commit comments