Java: Include column numbers in Location.toString

This commit is contained in:
Joe
2020-09-23 12:19:43 +01:00
committed by Joe Farebrother
parent 75d55c87b3
commit 8e82687ab6

View File

@@ -150,12 +150,18 @@ class Location extends @location {
/** Gets a string representation containing the file and range for this location. */
string toString() {
exists(File f, int startLine, int endLine |
locations_default(this, f, startLine, _, endLine, _)
exists(File f, int startLine, int startCol, int endLine, int endCol |
locations_default(this, f, startLine, startCol, endLine, endCol)
|
if endLine = startLine
then result = f.toString() + ":" + startLine.toString()
else result = f.toString() + ":" + startLine.toString() + "-" + endLine.toString()
then
result =
f.toString() + ":" + startLine.toString() + "[" + startCol.toString() + "-" +
endCol.toString() + "]"
else
result =
f.toString() + ":" + startLine.toString() + "[" + startCol.toString() + "]-" +
endLine.toString() + "[" + endCol.toString() + "]"
)
}