Skip to content

Commit 355504a

Browse files
committed
Swift: use File from QL library
1 parent 6f0ddaa commit 355504a

File tree

3 files changed

+22
-26
lines changed

3 files changed

+22
-26
lines changed
Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
22
private import codeql.swift.generated.File
33

4-
class File extends FileBase { }
4+
class File extends FileBase {
5+
/** toString */
6+
string toString() { result = getAbsolutePath() }
7+
8+
/** Gets the name of this file. */
9+
string getName() { files(this, result) }
10+
11+
/** Gets the absolute path of this file. */
12+
string getAbsolutePath() { result = getName() }
13+
14+
/** Gets the full name of this file. */
15+
string getFullName() { result = getAbsolutePath() }
16+
17+
/** Gets the URL of this file. */
18+
string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
19+
20+
/** Gets the base name of this file. */
21+
string getBaseName() {
22+
result = this.getAbsolutePath().regexpCapture(".*/(([^/]*?)(?:\\.([^.]*))?)", 1)
23+
}
24+
}

swift/ql/lib/swift.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/** Top-level import for the Swift language pack */
22

3-
import swift.File
3+
import codeql.swift.elements

swift/ql/lib/swift/File.qll

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)