add explicit this to member call

This commit is contained in:
Erik Krogh Kristensen
2022-01-20 22:28:44 +01:00
parent ddfc3bc00f
commit f500bccbe4
17 changed files with 222 additions and 198 deletions

View File

@@ -135,7 +135,7 @@ class ArrayPattern extends CasePattern, TArrayPattern {
(
n < this.restIndex()
or
not exists(restIndex())
not exists(this.restIndex())
)
}
@@ -156,7 +156,7 @@ class ArrayPattern extends CasePattern, TArrayPattern {
* ```
*/
LocalVariableWriteAccess getRestVariableAccess() {
toGenerated(result) = g.getChild(restIndex()).(Ruby::SplatParameter).getName()
toGenerated(result) = g.getChild(this.restIndex()).(Ruby::SplatParameter).getName()
}
/**
@@ -264,10 +264,10 @@ class HashPattern extends CasePattern, THashPattern {
private Ruby::KeywordPattern keyValuePair(int n) { result = g.getChild(n) }
/** Gets the key of the `n`th pair. */
StringlikeLiteral getKey(int n) { toGenerated(result) = keyValuePair(n).getKey() }
StringlikeLiteral getKey(int n) { toGenerated(result) = this.keyValuePair(n).getKey() }
/** Gets the value of the `n`th pair. */
CasePattern getValue(int n) { toGenerated(result) = keyValuePair(n).getValue() }
CasePattern getValue(int n) { toGenerated(result) = this.keyValuePair(n).getValue() }
/** Gets the value for a given key name. */
CasePattern getValueByKey(string key) {

View File

@@ -753,7 +753,7 @@ module Trees {
c.(MatchingCompletion).getValue() = false
or
exists(BooleanCompletion bc, boolean flag, MatchingCompletion mc |
lastCondition(last, bc, flag) and
this.lastCondition(last, bc, flag) and
c =
any(NestedMatchingCompletion nmc |
nmc.getInnerCompletion() = bc and nmc.getOuterCompletion() = mc
@@ -790,7 +790,7 @@ module Trees {
)
or
exists(boolean flag |
lastCondition(pred, c, flag) and
this.lastCondition(pred, c, flag) and
c.(BooleanCompletion).getValue() = flag and
first(this.getBody(), succ)
)

View File

@@ -78,7 +78,7 @@ class InlineFlowTest extends InlineExpectationsTest {
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasValueFlow" and
exists(DataFlow::Node src, DataFlow::Node sink | getValueFlowConfig().hasFlow(src, sink) |
exists(DataFlow::Node src, DataFlow::Node sink | this.getValueFlowConfig().hasFlow(src, sink) |
sink.getLocation() = location and
element = sink.toString() and
if exists(getSourceArgString(src)) then value = getSourceArgString(src) else value = ""
@@ -86,7 +86,8 @@ class InlineFlowTest extends InlineExpectationsTest {
or
tag = "hasTaintFlow" and
exists(DataFlow::Node src, DataFlow::Node sink |
getTaintFlowConfig().hasFlow(src, sink) and not getValueFlowConfig().hasFlow(src, sink)
this.getTaintFlowConfig().hasFlow(src, sink) and
not this.getValueFlowConfig().hasFlow(src, sink)
|
sink.getLocation() = location and
element = sink.toString() and