-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathDescriptors.qll
More file actions
31 lines (26 loc) · 1.01 KB
/
Descriptors.qll
File metadata and controls
31 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import python
private import semmle.python.objects.ObjectInternal
private import semmle.python.types.Object
private import semmle.python.types.FunctionObject
private import semmle.python.pointsto.Context
/** A class method object. Either a decorated function or an explicit call to classmethod(f) */
class ClassMethodObject extends Object {
ClassMethodObject() { any(ClassMethodObjectInternal cm).getOrigin() = this }
FunctionObject getFunction() {
exists(ClassMethodObjectInternal cm |
cm.getOrigin() = this and
result = cm.getFunction().getSource()
)
}
CallNode getACall() { result = this.getFunction().getACall() }
}
/** A static method object. Either a decorated function or an explicit call to staticmethod(f) */
class StaticMethodObject extends Object {
StaticMethodObject() { any(StaticMethodObjectInternal sm).getOrigin() = this }
FunctionObject getFunction() {
exists(StaticMethodObjectInternal sm |
sm.getOrigin() = this and
result = sm.getFunction().getSource()
)
}
}