Skip to content

Commit 2489280

Browse files
RasmusWLtausbn
andcommitted
Python: clsTracker => clsArgumentTracker
Co-authored-by: Taus <[email protected]>
1 parent 1c8cc6a commit 2489280

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowDispatch.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ Node selfTracker(Class classWithMethod) {
552552
/**
553553
* Gets a reference to the `cls` argument of a classmethod on class `classWithMethod`.
554554
*/
555-
private TypeTrackingNode clsTracker(TypeTracker t, Class classWithMethod) {
555+
private TypeTrackingNode clsArgumentTracker(TypeTracker t, Class classWithMethod) {
556556
t.start() and
557557
(
558558
exists(Function func |
@@ -567,15 +567,15 @@ private TypeTrackingNode clsTracker(TypeTracker t, Class classWithMethod) {
567567
result.(CallCfgNode).getArg(0) = selfTracker(classWithMethod)
568568
)
569569
or
570-
exists(TypeTracker t2 | result = clsTracker(t2, classWithMethod).track(t2, t)) and
570+
exists(TypeTracker t2 | result = clsArgumentTracker(t2, classWithMethod).track(t2, t)) and
571571
not result.(ParameterNodeImpl).isParameterOf(_, any(ParameterPosition pp | pp.isSelf()))
572572
}
573573

574574
/**
575575
* Gets a reference to the `cls` argument of a classmethod on class `classWithMethod`.
576576
*/
577-
Node clsTracker(Class classWithMethod) {
578-
clsTracker(TypeTracker::end(), classWithMethod).flowsTo(result)
577+
Node clsArgumentTracker(Class classWithMethod) {
578+
clsArgumentTracker(TypeTracker::end(), classWithMethod).flowsTo(result)
579579
}
580580

581581
/**
@@ -763,7 +763,7 @@ private TypeTrackingNode attrReadTracker(TypeTracker t, AttrRead attr) {
763763
t.start() and
764764
result = attr and
765765
attr.getObject() in [
766-
classTracker(_), classInstanceTracker(_), selfTracker(_), clsTracker(_),
766+
classTracker(_), classInstanceTracker(_), selfTracker(_), clsArgumentTracker(_),
767767
superCallNoArgumentTracker(_), superCallTwoArgumentTracker(_, _)
768768
]
769769
or
@@ -887,7 +887,7 @@ private module MethodCalls {
887887
) {
888888
call.getFunction() = attrReadTracker(attr).asCfgNode() and
889889
attr.accesses(self, functionName) and
890-
self in [clsTracker(classWithMethod), selfTracker(classWithMethod)]
890+
self in [clsArgumentTracker(classWithMethod), selfTracker(classWithMethod)]
891891
}
892892

893893
/**
@@ -897,7 +897,7 @@ private module MethodCalls {
897897
*/
898898
predicate fromSuperNewCall(CallNode call, Class classUsedInSuper, AttrRead attr, Node self) {
899899
fromSuper_join(call, "__new__", classUsedInSuper, attr, self) and
900-
self in [classTracker(_), clsTracker(_)]
900+
self in [classTracker(_), clsArgumentTracker(_)]
901901
}
902902

903903
/**
@@ -998,7 +998,7 @@ predicate resolveClassCall(CallNode call, Class cls) {
998998
or
999999
// `cls()` inside a classmethod (which also contains `type(self)()` inside a method)
10001000
exists(Class classWithMethod |
1001-
call.getFunction() = clsTracker(classWithMethod).asCfgNode() and
1001+
call.getFunction() = clsArgumentTracker(classWithMethod).asCfgNode() and
10021002
getADirectSuperclass*(cls) = classWithMethod
10031003
)
10041004
}
@@ -1149,7 +1149,7 @@ predicate getCallArg(
11491149
type instanceof CallTypeClassMethod and
11501150
apos.isSelf() and
11511151
resolveMethodCall(call, target, type, arg) and
1152-
(arg = classTracker(_) or arg = clsTracker(_)) and
1152+
(arg = classTracker(_) or arg = clsArgumentTracker(_)) and
11531153
// dataflow lib has requirement that arguments and calls are in same enclosing callable.
11541154
exists(CfgNode cfgNode | cfgNode.getNode() = call |
11551155
cfgNode.getEnclosingCallable() = arg.getEnclosingCallable()

0 commit comments

Comments
 (0)