File tree 3 files changed +8
-5
lines changed 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -314,15 +314,12 @@ class MarkdownDocument extends md.Document {
314
314
var textContent = _htmlEscape.convert (referenceText);
315
315
var linkedElement = result.commentReferable;
316
316
if (linkedElement != null ) {
317
- if (linkedElement.href != null ) {
317
+ if (linkedElement.href case var href ? ) {
318
318
var anchor = md.Element .text ('a' , textContent);
319
319
if (linkedElement is ModelElement && linkedElement.isDeprecated) {
320
320
anchor.attributes['class' ] = 'deprecated' ;
321
321
}
322
- var href = linkedElement.href;
323
- if (href != null ) {
324
- anchor.attributes['href' ] = href;
325
- }
322
+ anchor.attributes['href' ] = href;
326
323
return anchor;
327
324
} else {
328
325
// Otherwise this would be `linkedElement.linkedName`, but link bodies
Original file line number Diff line number Diff line change @@ -143,6 +143,11 @@ class Category
143
143
String get linkedName {
144
144
final unbrokenName = name.replaceAll (' ' , ' ' );
145
145
if (isDocumented) {
146
+ final href = this .href;
147
+ if (href == null ) {
148
+ throw StateError ("Requesting the 'linkedName' of a non-canonical "
149
+ "category: '$name '" );
150
+ }
146
151
return '<a href="$href ">$unbrokenName </a>' ;
147
152
} else {
148
153
return unbrokenName;
Original file line number Diff line number Diff line change @@ -687,6 +687,7 @@ abstract class ModelElement
687
687
element.kind == ElementKind .NEVER ||
688
688
this is ModelFunction );
689
689
690
+ final href = this .href;
690
691
if (href == null ) {
691
692
if (isPublicAndPackageDocumented) {
692
693
warn (PackageWarning .noCanonicalFound);
You can’t perform that action at this time.
0 commit comments