Skip to content
Snippets Groups Projects
Commit d2eaf66b authored by dgelessus's avatar dgelessus
Browse files

Fix a few minor issues with SourcePosition.compareTo

parent dfd33c0a
Branches
Tags 1.2.0
No related merge requests found
......@@ -25,10 +25,15 @@ public class SourcePosition implements Comparable<SourcePosition> {
return pos;
}
@Override
public int compareTo(SourcePosition that) {
if (that.line < line) return 1;
if (that.line > line) return -1;
return pos-that.pos;
if (this.line < that.line) {
return -1;
} else if (this.line > that.line) {
return 1;
} else {
return Integer.compare(this.pos, that.pos);
}
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment