@@ -21,28 +21,28 @@ predicate meaningful_return_value(Expr val) {
2121 or
2222 val instanceof BooleanLiteral
2323 or
24- exists ( FunctionObject callee | val = callee .getACall ( ) .getNode ( ) and returns_meaningful_value ( callee ) )
24+ exists ( FunctionValue callee | val = callee .getACall ( ) .getNode ( ) and returns_meaningful_value ( callee ) )
2525 or
26- not exists ( FunctionObject callee | val = callee .getACall ( ) .getNode ( ) ) and not val instanceof Name
26+ not exists ( FunctionValue callee | val = callee .getACall ( ) .getNode ( ) ) and not val instanceof Name
2727}
2828
2929/* Value is used before returning, and thus its value is not lost if ignored */
3030predicate used_value ( Expr val ) {
3131 exists ( LocalVariable var , Expr other | var .getAnAccess ( ) = val and other = var .getAnAccess ( ) and not other = val )
3232}
3333
34- predicate returns_meaningful_value ( FunctionObject f ) {
35- not exists ( f .getFunction ( ) .getFallthroughNode ( ) )
34+ predicate returns_meaningful_value ( FunctionValue f ) {
35+ not exists ( f .getScope ( ) .getFallthroughNode ( ) )
3636 and
3737 (
38- exists ( Return ret , Expr val | ret .getScope ( ) = f .getFunction ( ) and val = ret .getValue ( ) |
38+ exists ( Return ret , Expr val | ret .getScope ( ) = f .getScope ( ) and val = ret .getValue ( ) |
3939 meaningful_return_value ( val ) and
4040 not used_value ( val )
4141 )
4242 or
4343 /* Is f a builtin function that returns something other than None?
4444 * Ignore __import__ as it is often called purely for side effects */
45- f .isC ( ) and f .getAnInferredReturnType ( ) != theNoneType ( ) and not f .getName ( ) = "__import__"
45+ f .isBuiltin ( ) and f .getAnInferredReturnType ( ) != theNoneType ( ) and not f .getName ( ) = "__import__"
4646 )
4747}
4848
@@ -55,7 +55,7 @@ predicate wrapped_in_try_except(ExprStmt call) {
5555 )
5656}
5757
58- from ExprStmt call , FunctionObject callee , float percentage_used , int total
58+ from ExprStmt call , FunctionValue callee , float percentage_used , int total
5959where call .getValue ( ) = callee .getACall ( ) .getNode ( ) and returns_meaningful_value ( callee ) and
6060not wrapped_in_try_except ( call ) and
6161exists ( int unused |
0 commit comments