Skip to content

Commit 9c8bbe3

Browse files
committed
Swift: Add Location.toString.
1 parent 4d0c23c commit 9c8bbe3

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

swift/ql/lib/codeql/swift/elements/Location.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,15 @@ class Location extends LocationBase {
88
el = getEndLine() and
99
ec = getEndColumn()
1010
}
11+
12+
/**
13+
* Gets a textual representation of this location.
14+
*/
15+
override string toString() {
16+
exists(string filePath, int startLine, int startColumn, int endLine, int endColumn |
17+
this.hasLocationInfo(filePath, startLine, startColumn, endLine, endColumn)
18+
|
19+
toUrl(filePath, startLine, startColumn, endLine, endColumn, result)
20+
)
21+
}
1122
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| file://:0:0:0:0 | UnknownLocation |
2-
| location.swift:2:1:3:1 | DbLocation |
3-
| location.swift:2:11:2:14 | DbLocation |
4-
| location.swift:2:19:3:1 | DbLocation |
1+
| file://:0:0:0:0 | file://:0:0:0:0 |
2+
| location.swift:2:1:3:1 | location.swift:2:1:3:1 |
3+
| location.swift:2:11:2:14 | location.swift:2:11:2:14 |
4+
| location.swift:2:19:3:1 | location.swift:2:19:3:1 |

0 commit comments

Comments
 (0)