Python: Allow cls passing to classmethod

This commit is contained in:
Rasmus Wriedt Larsen
2022-10-20 15:11:49 +02:00
parent 0cf13e9976
commit 57c7dc8ea9
2 changed files with 2 additions and 2 deletions

View File

@@ -1054,7 +1054,7 @@ predicate getCallArg(
type instanceof CallTypeClassMethod and
apos.isSelf() and
resolveMethodCall(call, target, type, arg) and
arg = classTracker(_) and
(arg = classTracker(_) or arg = clsTracker(_)) and
// dataflow lib has requirement that arguments and calls are in same enclosing callable.
exists(CfgNode cfgNode | cfgNode.getNode() = call |
cfgNode.getEnclosingCallable() = arg.getEnclosingCallable()

View File

@@ -28,7 +28,7 @@ class MyClass(object):
@classmethod
def other_classmethod(cls):
cls.cm(42) # $ call=cls.cm(..) callType=CallTypeClassMethod arg[position 0]=42 MISSING: arg[self]=cls
cls.cm(42) # $ call=cls.cm(..) callType=CallTypeClassMethod arg[position 0]=42 arg[self]=cls
cls.sm(42) # $ call=cls.sm(..) callType=CallTypeStaticMethod arg[position 0]=42
def __getitem__(self, key):