mirror of https://github.com/sbt/sbt.git
cleanup SourcePosition hierarchy
This commit is contained in:
parent
52bca9bb8a
commit
7b194e3dee
|
|
@ -2,19 +2,19 @@ package sbt
|
||||||
|
|
||||||
sealed trait SourcePosition
|
sealed trait SourcePosition
|
||||||
|
|
||||||
sealed trait FilePosition {
|
sealed trait FilePosition extends SourcePosition {
|
||||||
def path: String
|
def path: String
|
||||||
def startLine: Int
|
def startLine: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
case object NoPosition extends SourcePosition
|
case object NoPosition extends SourcePosition
|
||||||
|
|
||||||
final case class LinePosition(path: String, startLine: Int) extends SourcePosition with FilePosition
|
final case class LinePosition(path: String, startLine: Int) extends FilePosition
|
||||||
|
|
||||||
final case class LineRange(start: Int, end: Int) {
|
final case class LineRange(start: Int, end: Int) {
|
||||||
def shift(n: Int) = new LineRange(start + n, end + n)
|
def shift(n: Int) = new LineRange(start + n, end + n)
|
||||||
}
|
}
|
||||||
|
|
||||||
final case class RangePosition(path: String, range: LineRange) extends SourcePosition with FilePosition {
|
final case class RangePosition(path: String, range: LineRange) extends FilePosition {
|
||||||
def startLine = range.start
|
def startLine = range.start
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue