mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: ObjectAPI to ValueAPI: ReturnValueIgnored: Reorganizes predicates
This commit is contained in:
@@ -50,7 +50,7 @@ predicate returns_meaningful_value(FunctionValue f) {
|
||||
*/
|
||||
|
||||
f.isBuiltin() and
|
||||
f.(CallableObjectInternal).getAnInferredReturnType() != ClassValue::nonetype() and
|
||||
f.getAnInferredReturnType() != ClassValue::nonetype() and
|
||||
not f.getName() = "__import__"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -49,13 +49,6 @@ abstract class CallableObjectInternal extends ObjectInternal {
|
||||
|
||||
/* Callables aren't iterable */
|
||||
override ObjectInternal getIterNext() { none() }
|
||||
|
||||
/** Gets a class that this function may return */
|
||||
ClassValue getAnInferredReturnType() {
|
||||
result = TBuiltinClassObject(this.(BuiltinFunctionObjectInternal).getReturnType())
|
||||
or
|
||||
result = TBuiltinClassObject(this.(BuiltinMethodObjectInternal).getReturnType())
|
||||
}
|
||||
}
|
||||
|
||||
/** Class representing Python functions */
|
||||
|
||||
@@ -581,6 +581,13 @@ abstract class FunctionValue extends CallableValue {
|
||||
exists(Expr expr, AstNode origin | expr.pointsTo(this, origin) | not origin instanceof Lambda)
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets a class that this function may return */
|
||||
ClassValue getAnInferredReturnType() {
|
||||
result = TBuiltinClassObject(this.(BuiltinFunctionObjectInternal).getReturnType())
|
||||
or
|
||||
result = TBuiltinClassObject(this.(BuiltinMethodObjectInternal).getReturnType())
|
||||
}
|
||||
}
|
||||
|
||||
/** Class representing Python functions */
|
||||
|
||||
Reference in New Issue
Block a user