@@ -469,7 +469,7 @@ mixin MixedInTypes on InheritingContainer {
469
469
/// Add the ability for an [InheritingContainer] to be implemented by other
470
470
/// InheritingContainers and to reference what it itself implements.
471
471
mixin TypeImplementing on InheritingContainer {
472
- late final List <DefinedElementType > directInterfaces = [
472
+ late final List <DefinedElementType > _directInterfaces = [
473
473
for (var interface in element.interfaces)
474
474
modelBuilder.typeFrom (interface , library) as DefinedElementType
475
475
];
@@ -486,7 +486,7 @@ mixin TypeImplementing on InheritingContainer {
486
486
bool get hasPublicInterfaces => publicInterfaces.isNotEmpty;
487
487
488
488
/// Interfaces directly implemented by this container.
489
- List <DefinedElementType > get interfaces => directInterfaces ;
489
+ List <DefinedElementType > get interfaces => _directInterfaces ;
490
490
491
491
/// Returns all the "immediate" public implementors of this
492
492
/// [TypeImplementing] . For a [Mixin] , this is actually the mixin
@@ -523,11 +523,14 @@ mixin TypeImplementing on InheritingContainer {
523
523
/// private interfaces, and so unlike other public* methods, is not
524
524
/// a strict subset of [interfaces] .
525
525
@override
526
- Iterable <DefinedElementType > get publicInterfaces sync * {
527
- for (var i in directInterfaces) {
526
+ Iterable <DefinedElementType > get publicInterfaces {
527
+ var interfaces = < DefinedElementType > [];
528
+ for (var interface in _directInterfaces) {
529
+ var interfaceElement = interface .modelElement;
530
+
528
531
/// Do not recurse if we can find an element here.
529
- if (i.modelElement .canonicalModelElement != null ) {
530
- yield i ;
532
+ if (interfaceElement .canonicalModelElement != null ) {
533
+ interfaces. add ( interface ) ;
531
534
continue ;
532
535
}
533
536
// Public types used to be unconditionally exposed here. However,
@@ -540,21 +543,21 @@ mixin TypeImplementing on InheritingContainer {
540
543
// the superchain and publicInterfaces of this interface to pretend
541
544
// as though the hidden class didn't exist and this class was declared
542
545
// directly referencing the canonical classes further up the chain.
543
- if (i.modelElement is InheritingContainer ) {
544
- var hiddenContainer = i.modelElement as InheritingContainer ;
545
- if (hiddenContainer.publicSuperChain.isNotEmpty) {
546
- yield hiddenContainer.publicSuperChain.first;
546
+ if (interfaceElement is InheritingContainer ) {
547
+ if (interfaceElement.publicSuperChain.isNotEmpty) {
548
+ interfaces.add (interfaceElement.publicSuperChain.first);
547
549
}
548
- yield * hiddenContainer. publicInterfaces;
550
+ interfaces. addAll (interfaceElement. publicInterfaces) ;
549
551
} else {
550
552
assert (
551
553
false ,
552
554
'Can not handle intermediate non-public interfaces created by '
553
555
'ModelElements that are not classes or mixins: $fullyQualifiedName '
554
- 'contains an interface $i , defined by ${ i . modelElement } ' );
556
+ 'contains an interface $interface , defined by $interfaceElement ' );
555
557
continue ;
556
558
}
557
559
}
560
+ return interfaces;
558
561
}
559
562
}
560
563
0 commit comments