Skip to content

Commit f29457f

Browse files
authored
QL: Merge pull request #113 from github/erik-krogh/fix-implcit-this
fix implicit this
2 parents 9330fa0 + f9d8ae5 commit f29457f

3 files changed

Lines changed: 67 additions & 61 deletions

File tree

ql/src/codeql/files/FileSystem.qll

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ abstract class Container extends @container {
99
Container getAChildContainer() { this = result.getParentContainer() }
1010

1111
/** Gets a file in this container. */
12-
File getAFile() { result = getAChildContainer() }
12+
File getAFile() { result = this.getAChildContainer() }
1313

1414
/** Gets a sub-folder in this container. */
15-
Folder getAFolder() { result = getAChildContainer() }
15+
Folder getAFolder() { result = this.getAChildContainer() }
1616

1717
/**
1818
* Gets the absolute, canonical path of this container, using forward slashes
@@ -58,7 +58,7 @@ abstract class Container extends @container {
5858
* </table>
5959
*/
6060
string getBaseName() {
61-
result = getAbsolutePath().regexpCapture(".*/(([^/]*?)(?:\\.([^.]*))?)", 1)
61+
result = this.getAbsolutePath().regexpCapture(".*/(([^/]*?)(?:\\.([^.]*))?)", 1)
6262
}
6363

6464
/**
@@ -84,17 +84,19 @@ abstract class Container extends @container {
8484
* <tr><td>"/tmp/x.tar.gz"</td><td>"gz"</td></tr>
8585
* </table>
8686
*/
87-
string getExtension() { result = getAbsolutePath().regexpCapture(".*/([^/]*?)(\\.([^.]*))?", 3) }
87+
string getExtension() {
88+
result = this.getAbsolutePath().regexpCapture(".*/([^/]*?)(\\.([^.]*))?", 3)
89+
}
8890

8991
/** Gets the file in this container that has the given `baseName`, if any. */
9092
File getFile(string baseName) {
91-
result = getAFile() and
93+
result = this.getAFile() and
9294
result.getBaseName() = baseName
9395
}
9496

9597
/** Gets the sub-folder in this container that has the given `baseName`, if any. */
9698
Folder getFolder(string baseName) {
97-
result = getAFolder() and
99+
result = this.getAFolder() and
98100
result.getBaseName() = baseName
99101
}
100102

@@ -111,7 +113,7 @@ abstract class Container extends @container {
111113
*/
112114
string getRelativePath() {
113115
exists(string absPath, string pref |
114-
absPath = getAbsolutePath() and sourceLocationPrefix(pref)
116+
absPath = this.getAbsolutePath() and sourceLocationPrefix(pref)
115117
|
116118
absPath = pref and result = ""
117119
or
@@ -137,7 +139,9 @@ abstract class Container extends @container {
137139
* <tr><td>"/tmp/x.tar.gz"</td><td>"x.tar"</td></tr>
138140
* </table>
139141
*/
140-
string getStem() { result = getAbsolutePath().regexpCapture(".*/([^/]*?)(?:\\.([^.]*))?", 1) }
142+
string getStem() {
143+
result = this.getAbsolutePath().regexpCapture(".*/([^/]*?)(?:\\.([^.]*))?", 1)
144+
}
141145

142146
/**
143147
* Gets a URL representing the location of this container.
@@ -151,15 +155,15 @@ abstract class Container extends @container {
151155
*
152156
* This is the absolute path of the container.
153157
*/
154-
string toString() { result = getAbsolutePath() }
158+
string toString() { result = this.getAbsolutePath() }
155159
}
156160

157161
/** A folder. */
158162
class Folder extends Container, @folder {
159163
override string getAbsolutePath() { folders(this, result, _) }
160164

161165
/** Gets the URL of this folder. */
162-
override string getURL() { result = "folder://" + getAbsolutePath() }
166+
override string getURL() { result = "folder://" + this.getAbsolutePath() }
163167
}
164168

165169
/** A file. */

0 commit comments

Comments
 (0)