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