Skip to content

Commit 33178b0

Browse files
committed
Add outermost utility method to SourcePosition.
Not needed right now, but might be useful in the future.
1 parent 77f65f8 commit 33178b0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ extends interfaces.SourcePosition with Showable {
6161
def focus : SourcePosition = withSpan(span.focus)
6262
def toSynthetic: SourcePosition = withSpan(span.toSynthetic)
6363

64+
def outermost: SourcePosition =
65+
if outer == null || outer == NoSourcePosition then this else outer.outermost
66+
6467
override def toString: String =
6568
s"${if (source.exists) source.file.toString else "(no source)"}:$span"
6669

0 commit comments

Comments
 (0)