|
1 | 1 | private import codeql.swift.generated.Location |
2 | 2 |
|
| 3 | +/** |
| 4 | + * A location of a program element. |
| 5 | + */ |
3 | 6 | class Location extends LocationBase { |
4 | | - predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) { |
5 | | - path = getFile().getFullName() and |
6 | | - sl = getStartLine() and |
7 | | - sc = getStartColumn() and |
8 | | - el = getEndLine() and |
9 | | - ec = getEndColumn() |
| 7 | + /** |
| 8 | + * Holds if this location is described by `path`, `startLine`, `startColumn`, `endLine` and `endColumn`. |
| 9 | + */ |
| 10 | + predicate hasLocationInfo(string path, int startLine, int startColumn, int endLine, int endColumn) { |
| 11 | + path = this.getFile().getFullName() and |
| 12 | + startLine = this.getStartLine() and |
| 13 | + startColumn = this.getStartColumn() and |
| 14 | + endLine = this.getEndLine() and |
| 15 | + endColumn = this.getEndColumn() |
| 16 | + } |
| 17 | + |
| 18 | + /** |
| 19 | + * Gets a textual representation of this location. |
| 20 | + */ |
| 21 | + override string toString() { |
| 22 | + exists(string filePath, int startLine, int startColumn, int endLine, int endColumn | |
| 23 | + this.hasLocationInfo(filePath, startLine, startColumn, endLine, endColumn) |
| 24 | + | |
| 25 | + toUrl(filePath, startLine, startColumn, endLine, endColumn, result) |
| 26 | + ) |
10 | 27 | } |
11 | 28 | } |
0 commit comments