@@ -94,20 +94,24 @@ List<DartdocOption<Object?>> createPackageWarningOptions(
9494
9595/// Something that package warnings can be reported on. Optionally associated
9696/// with an analyzer [element] .
97- mixin Warnable implements CommentReferable , Documentable , Locatable {
97+ mixin Warnable implements CommentReferable , Documentable , HasLocation {
9898 Element ? get element;
9999
100100 void warn (
101101 PackageWarning kind, {
102102 String ? message,
103- Iterable <Locatable > referredFrom = const [],
103+ Iterable <HasLocation > referredFrom = const [],
104104 Iterable <String > extendedDebug = const [],
105105 }) {
106106 packageGraph.warnOnElement (this , kind,
107107 message: message,
108108 referredFrom: referredFrom,
109109 extendedDebug: extendedDebug);
110110 }
111+
112+ /// Whether [documentationFrom] contains only one item, `this` .
113+ bool get documentationIsLocal =>
114+ documentationFrom.length == 1 && identical (documentationFrom.first, this );
111115}
112116
113117/// The kinds of warnings that can be displayed when documenting a package.
@@ -326,7 +330,7 @@ enum PackageWarning implements Comparable<PackageWarning> {
326330 String messageForWarnable (Warnable warnable) =>
327331 '$_warnablePrefix ${warnable .safeWarnableName }: ${warnable .location }' ;
328332
329- String messageForReferral (Locatable referral) =>
333+ String messageForReferral (HasLocation referral) =>
330334 '$_referredFromPrefix ${referral .safeWarnableName }: ${referral .location }' ;
331335}
332336
0 commit comments