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() {
2323}
2424
2525private 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 ) )
3328 )
3429 or
3530 s .getName ( ) = "__init__" and result = 1
3631 or
3732 not s instanceof Function and result = 0
3833}
3934
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+
4041private int incoming_call_cost ( Scope s ) {
4142 /*
4243 * Syntactic call count will often be a considerable overestimate
You can’t perform that action at this time.
0 commit comments