File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
python/ql/lib/semmle/python/pointsto Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -23,20 +23,21 @@ private int max_context_cost() {
23
23
}
24
24
25
25
private int syntactic_call_count ( Scope s ) {
26
- exists ( Function f | f = s and f .getName ( ) != "__init__" |
27
- result =
28
- count ( CallNode call |
29
- call .getFunction ( ) .( NameNode ) .getId ( ) = f .getName ( )
30
- or
31
- call .getFunction ( ) .( AttrNode ) .getName ( ) = f .getName ( )
32
- )
26
+ exists ( Function f , string name | f = s and name = f .getName ( ) and name != "__init__" |
27
+ result = count ( function_call ( name ) ) + count ( method_call ( name ) )
33
28
)
34
29
or
35
30
s .getName ( ) = "__init__" and result = 1
36
31
or
37
32
not s instanceof Function and result = 0
38
33
}
39
34
35
+ pragma [ nomagic]
36
+ private CallNode function_call ( string name ) { result .getFunction ( ) .( NameNode ) .getId ( ) = name }
37
+
38
+ pragma [ nomagic]
39
+ private CallNode method_call ( string name ) { result .getFunction ( ) .( AttrNode ) .getName ( ) = name }
40
+
40
41
private int incoming_call_cost ( Scope s ) {
41
42
/*
42
43
* Syntactic call count will often be a considerable overestimate
You can’t perform that action at this time.
0 commit comments