Skip to content
Snippets Groups Projects
Commit eec62576 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Proper ordering for positions

parent 0303b636
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,6 @@ object ChooseInfo {
}
}
results.sortBy(_.fd.id.toString)
results.sortBy(_.source.getPos)
}
}
......@@ -5,13 +5,22 @@ package utils
import java.io.File
abstract class Position {
abstract class Position extends Ordered[Position] {
val line: Int
val col: Int
val file: File
def < (that: Position) = {
(this.file == that.file) && (this.line < that.line || this.col < that.col)
def compare(that: Position) = {
if (this.file == that.file) {
val ld = this.line - that.line
if (ld == 0) {
this.col - that.col
} else {
ld
}
} else {
0
}
}
def fullString: String
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment