@@ -21,8 +21,28 @@ import 'package:dartdoc/src/special_elements.dart';
2121/// place in the documentation, and we pick a canonical class because that's
2222/// the one in the public namespace that will be documented.
2323mixin Inheritable on ContainerMember {
24+ /// True if this [Inheritable] is inherited from a different class.
25+ bool get isInherited;
26+
27+ /// True if this [Inheritable] has a parameter whose type is overridden
28+ /// by a subtype.
29+ bool get isCovariant;
30+
31+ @override
32+ Set <String > get features {
33+ Set <String > _features = super .features;
34+ if (isOverride) _features.add ('override' );
35+ if (isInherited) _features.add ('inherited' );
36+ if (isCovariant) _features.add ('covariant' );
37+ return _features;
38+ }
39+
40+ @override
41+ Library get canonicalLibrary => canonicalEnclosingContainer? .canonicalLibrary;
42+
2443 @override
2544 ModelElement buildCanonicalModelElement () {
45+ // TODO(jcollins-g): factor out extension logic into [Extendable]
2646 if (canonicalEnclosingContainer is Extension ) {
2747 return this ;
2848 }
@@ -34,6 +54,9 @@ mixin Inheritable on ContainerMember {
3454 m.name == name && m.isPropertyAccessor == isPropertyAccessor,
3555 orElse: () => null );
3656 }
57+ if (canonicalEnclosingContainer != null ) {
58+ throw UnimplementedError ('${canonicalEnclosingContainer }: unknown type' );
59+ }
3760 return null ;
3861 }
3962
@@ -77,8 +100,14 @@ mixin Inheritable on ContainerMember {
77100 if (definingEnclosingContainer.isCanonical &&
78101 definingEnclosingContainer.isPublic) {
79102 assert (definingEnclosingContainer == found);
103+ }
104+ if (found != null ) {
80105 return found;
81106 }
107+ } else if (! isInherited && definingEnclosingContainer is ! Extension ) {
108+ // TODO(jcollins-g): factor out extension logic into [Extendable].
109+ return packageGraph
110+ .findCanonicalModelElementFor (element.enclosingElement);
82111 }
83112 return super .computeCanonicalEnclosingContainer ();
84113 }
@@ -104,7 +133,7 @@ mixin Inheritable on ContainerMember {
104133
105134 bool _isOverride;
106135
107- @override
136+ /// True if this [Inheritable] is overriding a superclass.
108137 bool get isOverride {
109138 if (_isOverride == null ) {
110139 // The canonical version of the enclosing element -- not canonicalEnclosingElement,
0 commit comments