mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Swift: use File from QL library
This commit is contained in:
@@ -1,4 +1,24 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.File
|
||||
|
||||
class File extends FileBase { }
|
||||
class File extends FileBase {
|
||||
/** toString */
|
||||
string toString() { result = getAbsolutePath() }
|
||||
|
||||
/** Gets the name of this file. */
|
||||
string getName() { files(this, result) }
|
||||
|
||||
/** Gets the absolute path of this file. */
|
||||
string getAbsolutePath() { result = getName() }
|
||||
|
||||
/** Gets the full name of this file. */
|
||||
string getFullName() { result = getAbsolutePath() }
|
||||
|
||||
/** Gets the URL of this file. */
|
||||
string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
|
||||
|
||||
/** Gets the base name of this file. */
|
||||
string getBaseName() {
|
||||
result = this.getAbsolutePath().regexpCapture(".*/(([^/]*?)(?:\\.([^.]*))?)", 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
/** Top-level import for the Swift language pack */
|
||||
|
||||
import swift.File
|
||||
import codeql.swift.elements
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/** TODO: to be replaced */
|
||||
|
||||
/** A file. */
|
||||
class File extends @file {
|
||||
/** toString */
|
||||
string toString() { result = getAbsolutePath() }
|
||||
|
||||
/** Gets the name of this file. */
|
||||
string getName() { files(this, result) }
|
||||
|
||||
/** Gets the absolute path of this file. */
|
||||
string getAbsolutePath() { result = getName() }
|
||||
|
||||
/** Gets the full name of this file. */
|
||||
string getFullName() { result = getAbsolutePath() }
|
||||
|
||||
/** Gets the URL of this file. */
|
||||
string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
|
||||
|
||||
/** Gets the base name of this file. */
|
||||
string getBaseName() {
|
||||
result = this.getAbsolutePath().regexpCapture(".*/(([^/]*?)(?:\\.([^.]*))?)", 1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user