File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 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 {
314314 var textContent = _htmlEscape.convert (referenceText);
315315 var linkedElement = result.commentReferable;
316316 if (linkedElement != null ) {
317- if (linkedElement.href != null ) {
317+ if (linkedElement.href case var href ? ) {
318318 var anchor = md.Element .text ('a' , textContent);
319319 if (linkedElement is ModelElement && linkedElement.isDeprecated) {
320320 anchor.attributes['class' ] = 'deprecated' ;
321321 }
322- var href = linkedElement.href;
323- if (href != null ) {
324- anchor.attributes['href' ] = href;
325- }
322+ anchor.attributes['href' ] = href;
326323 return anchor;
327324 } else {
328325 // 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
143143 String get linkedName {
144144 final unbrokenName = name.replaceAll (' ' , ' ' );
145145 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+ }
146151 return '<a href="$href ">$unbrokenName </a>' ;
147152 } else {
148153 return unbrokenName;
Original file line number Diff line number Diff line change @@ -687,6 +687,7 @@ abstract class ModelElement
687687 element.kind == ElementKind .NEVER ||
688688 this is ModelFunction );
689689
690+ final href = this .href;
690691 if (href == null ) {
691692 if (isPublicAndPackageDocumented) {
692693 warn (PackageWarning .noCanonicalFound);
You can’t perform that action at this time.
0 commit comments