add all remaining explicit this

This commit is contained in:
Erik Krogh Kristensen
2021-11-26 13:50:10 +01:00
parent 00ee34c0a0
commit 6ff8d4de5c
104 changed files with 479 additions and 451 deletions

View File

@@ -19,7 +19,9 @@ class ExternalDefect extends @externalDefect {
Location getLocation() { externalDefects(this, _, result, _, _) }
/** Gets a textual representation of this element. */
string toString() { result = getQueryPath() + ": " + getLocation() + " - " + getMessage() }
string toString() {
result = this.getQueryPath() + ": " + this.getLocation() + " - " + this.getMessage()
}
}
class ExternalMetric extends @externalMetric {
@@ -30,7 +32,9 @@ class ExternalMetric extends @externalMetric {
Location getLocation() { externalMetrics(this, _, result, _) }
/** Gets a textual representation of this element. */
string toString() { result = getQueryPath() + ": " + getLocation() + " - " + getValue() }
string toString() {
result = this.getQueryPath() + ": " + this.getLocation() + " - " + this.getValue()
}
}
/**
@@ -44,7 +48,7 @@ class ExternalData extends @externalDataElement {
* Gets the path of the file this data was loaded from, with its
* extension replaced by `.ql`.
*/
string getQueryPath() { result = getDataPath().regexpReplaceAll("\\.[^.]*$", ".ql") }
string getQueryPath() { result = this.getDataPath().regexpReplaceAll("\\.[^.]*$", ".ql") }
/** Gets the number of fields in this data item. */
int getNumFields() { result = 1 + max(int i | externalData(this, _, i, _) | i) }
@@ -53,22 +57,23 @@ class ExternalData extends @externalDataElement {
string getField(int index) { externalData(this, _, index, result) }
/** Gets the integer value of the field at position `index` of this data item. */
int getFieldAsInt(int index) { result = getField(index).toInt() }
int getFieldAsInt(int index) { result = this.getField(index).toInt() }
/** Gets the floating-point value of the field at position `index` of this data item. */
float getFieldAsFloat(int index) { result = getField(index).toFloat() }
float getFieldAsFloat(int index) { result = this.getField(index).toFloat() }
/** Gets the value of the field at position `index` of this data item, interpreted as a date. */
date getFieldAsDate(int index) { result = getField(index).toDate() }
date getFieldAsDate(int index) { result = this.getField(index).toDate() }
/** Gets a textual representation of this data item. */
string toString() { result = getQueryPath() + ": " + buildTupleString(0) }
string toString() { result = this.getQueryPath() + ": " + this.buildTupleString(0) }
/** Gets a textual representation of this data item, starting with the field at position `start`. */
private string buildTupleString(int start) {
start = getNumFields() - 1 and result = getField(start)
start = this.getNumFields() - 1 and result = this.getField(start)
or
start < getNumFields() - 1 and result = getField(start) + "," + buildTupleString(start + 1)
start < this.getNumFields() - 1 and
result = this.getField(start) + "," + this.buildTupleString(start + 1)
}
}
@@ -81,7 +86,7 @@ class DefectExternalData extends ExternalData {
this.getNumFields() = 2
}
string getURL() { result = getField(0) }
string getURL() { result = this.getField(0) }
string getMessage() { result = getField(1) }
string getMessage() { result = this.getField(1) }
}

View File

@@ -13,9 +13,9 @@ class ThriftElement extends ExternalData {
string getKind() { result = kind }
string getId() { result = getField(0) }
string getId() { result = this.getField(0) }
int getIndex() { result = getFieldAsInt(1) }
int getIndex() { result = this.getFieldAsInt(1) }
ThriftElement getParent() { result.getId() = this.getField(2) }

View File

@@ -29,7 +29,7 @@ class Commit extends @svnentry {
)
}
string getAnAffectedFilePath() { result = getAnAffectedFilePath(_) }
string getAnAffectedFilePath() { result = this.getAnAffectedFilePath(_) }
File getAnAffectedFile(string action) { svnaffectedfiles(this, result, action) }
@@ -38,7 +38,7 @@ class Commit extends @svnentry {
predicate isRecent() { recentCommit(this) }
int daysToNow() {
exists(date now | snapshotDate(now) | result = getDate().daysTo(now) and result >= 0)
exists(date now | snapshotDate(now) | result = this.getDate().daysTo(now) and result >= 0)
}
int getRecentAdditionsForFile(File f) { svnchurn(this, f, result, _) }
@@ -46,7 +46,7 @@ class Commit extends @svnentry {
int getRecentDeletionsForFile(File f) { svnchurn(this, f, _, result) }
int getRecentChurnForFile(File f) {
result = getRecentAdditionsForFile(f) + getRecentDeletionsForFile(f)
result = this.getRecentAdditionsForFile(f) + this.getRecentDeletionsForFile(f)
}
}