Merge pull request #4341 from joefarebrother/location-tostring

Java: Include column numbers in Location.toString
This commit is contained in:
Anders Schack-Mulligen
2020-10-06 14:42:35 +02:00
committed by GitHub

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() + "]"
)
}