Skip to content

Commit a611568

Browse files
authored
Python: More implicit this
1 parent a9c8163 commit a611568

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

python/ql/lib/semmle/python/essa/Definitions.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ class ModuleVariable extends SsaSourceVariable {
225225
}
226226

227227
override ControlFlowNode getAnImplicitUse() {
228-
result = global_variable_callnode()
228+
result = this.global_variable_callnode()
229229
or
230-
result = global_variable_import()
230+
result = this.global_variable_import()
231231
or
232232
exists(ImportTimeScope scope | scope.entryEdge(result, _) |
233233
this = scope.getOuterVariable(_) or

python/ql/lib/semmle/python/essa/Essa.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class EssaVariable extends TEssaDefinition {
4141
*/
4242
ControlFlowNode getASourceUse() {
4343
exists(SsaSourceVariable var |
44-
result = use_for_var(var) and
44+
result = this.use_for_var(var) and
4545
result = var.getASourceUse()
4646
)
4747
}
@@ -258,7 +258,7 @@ class PhiFunction extends EssaDefinition, TPhiFunction {
258258
/** Gets another definition of the same source variable that reaches this definition. */
259259
private EssaDefinition reachingDefinition(BasicBlock pred) {
260260
result.getScope() = this.getScope() and
261-
result.getSourceVariable() = pred_var(pred) and
261+
result.getSourceVariable() = this.pred_var(pred) and
262262
result.reachesEndOfBlock(pred)
263263
}
264264

python/ql/lib/semmle/python/frameworks/Django.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,11 +1844,13 @@ private module PrivateDjango {
18441844
t.start() and
18451845
result.asCfgNode().(CallNode).getFunction() = this.asViewRef().asCfgNode()
18461846
or
1847-
exists(DataFlow::TypeTracker t2 | result = asViewResult(t2).track(t2, t))
1847+
exists(DataFlow::TypeTracker t2 | result = this.asViewResult(t2).track(t2, t))
18481848
}
18491849

18501850
/** Gets a reference to the result of calling the `as_view` classmethod of this class. */
1851-
DataFlow::Node asViewResult() { asViewResult(DataFlow::TypeTracker::end()).flowsTo(result) }
1851+
DataFlow::Node asViewResult() {
1852+
this.asViewResult(DataFlow::TypeTracker::end()).flowsTo(result)
1853+
}
18521854
}
18531855

18541856
/** A class that we consider a django View class. */
@@ -1944,10 +1946,10 @@ private module PrivateDjango {
19441946
abstract DataFlow::Node getViewArg();
19451947

19461948
final override DjangoRouteHandler getARequestHandler() {
1947-
poorMansFunctionTracker(result) = getViewArg()
1949+
poorMansFunctionTracker(result) = this.getViewArg()
19481950
or
19491951
exists(DjangoViewClass vc |
1950-
getViewArg() = vc.asViewResult() and
1952+
this.getViewArg() = vc.asViewResult() and
19511953
result = vc.getARequestHandler()
19521954
)
19531955
}

python/ql/lib/semmle/python/frameworks/Flask.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,12 @@ module Flask {
292292

293293
override Function getARequestHandler() {
294294
exists(DataFlow::LocalSourceNode func_src |
295-
func_src.flowsTo(getViewArg()) and
295+
func_src.flowsTo(this.getViewArg()) and
296296
func_src.asExpr().(CallableExpr) = result.getDefinition()
297297
)
298298
or
299299
exists(FlaskViewClass vc |
300-
getViewArg() = vc.asViewResult().getAUse() and
300+
this.getViewArg() = vc.asViewResult().getAUse() and
301301
result = vc.getARequestHandler()
302302
)
303303
}

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ private module StdlibPrivate {
397397
result = this.get_executable_arg()
398398
or
399399
exists(DataFlow::Node arg_args, boolean shell |
400-
arg_args = get_args_arg() and
401-
shell = get_shell_arg_value()
400+
arg_args = this.get_args_arg() and
401+
shell = this.get_shell_arg_value()
402402
|
403403
// When "executable" argument is set, and "shell" argument is `False`, the
404404
// "args" argument will only be used to set the program name and arguments to

0 commit comments

Comments
 (0)