mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Python: ObjectAPI to ValueAPI: IterReturnsNonIterature: Replaces custom return_type predicate with call to getAnInferredReturnType
This commit is contained in:
@@ -12,18 +12,10 @@
|
||||
|
||||
import python
|
||||
|
||||
ClassValue return_type(FunctionValue f) {
|
||||
exists(ControlFlowNode n, Return ret |
|
||||
ret.getScope() = f.getScope() and
|
||||
ret.getValue() = n.getNode() and
|
||||
result = n.pointsTo().getClass()
|
||||
)
|
||||
}
|
||||
|
||||
from ClassValue iterable, FunctionValue iter, ClassValue iterator
|
||||
where
|
||||
iter = iterable.lookup("__iter__") and
|
||||
iterator = return_type(iter) and
|
||||
iterator = iter.getAnInferredReturnType() and
|
||||
not iterator.isIterator()
|
||||
select iterator,
|
||||
"Class " + iterator.getName() +
|
||||
|
||||
Reference in New Issue
Block a user