@@ -14,6 +14,7 @@ import 'package:dartdoc/src/model/comment_referable.dart';
1414import 'package:dartdoc/src/model/model.dart' ;
1515import 'package:dartdoc/src/package_meta.dart' ;
1616import 'package:dartdoc/src/utils.dart' ;
17+ import 'package:meta/meta.dart' ;
1718
1819const _namePlaceholder = '@@name@@' ;
1920
@@ -94,13 +95,13 @@ List<DartdocOption<Object?>> createPackageWarningOptions(
9495
9596/// Something that package warnings can be reported on. Optionally associated
9697/// with an analyzer [element] .
97- mixin Warnable implements CommentReferable , Documentable , HasLocation {
98+ mixin Warnable implements CommentReferable , Documentable {
9899 Element ? get element;
99100
100101 void warn (
101102 PackageWarning kind, {
102103 String ? message,
103- Iterable <HasLocation > referredFrom = const [],
104+ Iterable <Warnable > referredFrom = const [],
104105 Iterable <String > extendedDebug = const [],
105106 }) {
106107 packageGraph.warnOnElement (this , kind,
@@ -112,6 +113,28 @@ mixin Warnable implements CommentReferable, Documentable, HasLocation {
112113 /// Whether [documentationFrom] contains only one item, `this` .
113114 bool get documentationIsLocal =>
114115 documentationFrom.length == 1 && identical (documentationFrom.first, this );
116+
117+ /// The [Warnable] s from which we will get documentation.
118+ ///
119+ /// Can be more than one if this is a [Field] composing documentation from
120+ /// multiple [Accessor] s.
121+ ///
122+ /// This will walk up the inheritance hierarchy to find docs, if the current
123+ /// class doesn't have docs for this element.
124+ List <Warnable > get documentationFrom;
125+
126+ /// The URI of this [Warnable] .
127+ @visibleForOverriding
128+ String get location;
129+
130+ /// Whether this is the "canonical" copy of an element.
131+ ///
132+ /// Generally, a canonical element must be public, along with possibly other
133+ /// requirements.
134+ ///
135+ /// In order for an element to be documented, it must be canonical, and have
136+ /// documentation.
137+ bool get isCanonical;
115138}
116139
117140/// The kinds of warnings that can be displayed when documenting a package.
@@ -330,7 +353,7 @@ enum PackageWarning implements Comparable<PackageWarning> {
330353 String messageForWarnable (Warnable warnable) =>
331354 '$_warnablePrefix ${warnable .safeWarnableName }: ${warnable .location }' ;
332355
333- String messageForReferral (HasLocation referral) =>
356+ String messageForReferral (Warnable referral) =>
334357 '$_referredFromPrefix ${referral .safeWarnableName }: ${referral .location }' ;
335358}
336359
@@ -659,3 +682,8 @@ extension on Map<PackageWarning, int> {
659682 }
660683 }
661684}
685+
686+ extension NullableWarnableExtension on Warnable ? {
687+ String get safeWarnableName =>
688+ this ? .fullyQualifiedName.replaceFirst (':' , '-' ) ?? '<unknown>' ;
689+ }
0 commit comments