@@ -403,7 +403,7 @@ abstract class ModelElement extends Canonicalization
403
403
// akin to source_gen's Reviver, in order to link to inner components. For
404
404
// example, in `@Foo(const Bar(), baz: <Baz>[Baz.one, Baz.two])`, link to
405
405
// `Foo`, `Bar`, `Baz`, `Baz.one`, and `Baz.two`.
406
- List <String > annotationsFromMetadata (List <ElementAnnotation > md) {
406
+ List <String > annotationsFromMetadata (Iterable <ElementAnnotation > md) {
407
407
var annotationStrings = < String > [];
408
408
if (md == null ) return annotationStrings;
409
409
for (var a in md) {
@@ -522,21 +522,26 @@ abstract class ModelElement extends Canonicalization
522
522
.split (locationSplitter)
523
523
.where ((s) => s.isNotEmpty));
524
524
525
- Set <String > get features {
526
- var allFeatures = < String > {...annotations};
527
-
525
+ static final Set <String > _specialFeatures = {
528
526
// Replace the @override annotation with a feature that explicitly
529
527
// indicates whether an override has occurred.
530
- allFeatures.remove ('@override' );
531
-
528
+ 'override' ,
532
529
// Drop the plain "deprecated" annotation; that's indicated via
533
530
// 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)
541
+ 'final' ,
542
+ if (isLate)
543
+ 'late' ,
544
+ };
540
545
}
541
546
542
547
String get featuresAsString {
0 commit comments