Skip to content

Commit c341f5c

Browse files
committed
Fix line number in the "Link to Crossdart" link
It used to point to the beginning of the comment section, and also was off by 1 (I guess because `LineNumberCache` counts them from 0, but www.crossdart.info starts from 1). Now it points to the actual declaration.
1 parent 1430d4f commit c341f5c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/src/model.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,8 +2025,10 @@ abstract class SourceCodeMixin {
20252025
int get _lineNumber {
20262026
var node = element.computeNode();
20272027
if (node is Declaration && (node as Declaration).element != null) {
2028-
return lineNumberCache.lineNumber(
2029-
(node as Declaration).element.source.fullName, node.offset);
2028+
var element = (node as Declaration).element;
2029+
var lineNumber = lineNumberCache.lineNumber(
2030+
element.source.fullName, element.nameOffset);
2031+
return lineNumber + 1;
20302032
} else {
20312033
return null;
20322034
}

0 commit comments

Comments
 (0)