Skip to content

Commit 84d33d4

Browse files
committed
SourcePosition#line: Avoid unnecessary IO
Looks like I missed this in 99574e2.
1 parent a162b7b commit 84d33d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/util/SourcePosition.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extends interfaces.SourcePosition with Showable {
2222

2323
def point: Int = span.point
2424

25-
def line: Int = if (source.file.exists) source.offsetToLine(point) else -1
25+
def line: Int = if (source.content().length != 0) source.offsetToLine(point) else -1
2626

2727
/** Extracts the lines from the underlying source file as `Array[Char]`*/
2828
def linesSlice: Array[Char] =

0 commit comments

Comments
 (0)