Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/src/model/constructor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/element2.dart';
import 'package:analyzer/source/line_info.dart';
// ignore: implementation_imports
import 'package:analyzer/src/dart/element/element.dart';
// ignore: implementation_imports
import 'package:analyzer/src/utilities/extensions/element.dart';
import 'package:dartdoc/src/element_type.dart';
import 'package:dartdoc/src/model/comment_referable.dart';
Expand All @@ -31,7 +33,13 @@ class Constructor extends ModelElement with ContainerMember, TypeParameters {
// parent class.
return enclosingElement.characterLocation;
}
return super.characterLocation;
final lineInfo = unitElement.lineInfo;
var offset = element2.firstFragment.nameOffset2 ??
(element2.firstFragment as ConstructorElementImpl).typeNameOffset;
if (offset != null && offset >= 0) {
return lineInfo.getLocation(offset);
}
return null;
}

@override
Expand Down
Loading