Skip to content

Commit 7a586c9

Browse files
committed
Python: ObjectAPI to ValueAPI: IterReturnsNonIterature: Replaces custom return_type predicate with call to getAnInferredReturnType
1 parent 0d65db1 commit 7a586c9

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

python/ql/src/Functions/IterReturnsNonIterator.ql

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,10 @@
1212

1313
import python
1414

15-
ClassValue return_type(FunctionValue f) {
16-
exists(ControlFlowNode n, Return ret |
17-
ret.getScope() = f.getScope() and
18-
ret.getValue() = n.getNode() and
19-
result = n.pointsTo().getClass()
20-
)
21-
}
22-
2315
from ClassValue iterable, FunctionValue iter, ClassValue iterator
2416
where
2517
iter = iterable.lookup("__iter__") and
26-
iterator = return_type(iter) and
18+
iterator = iter.getAnInferredReturnType() and
2719
not iterator.isIterator()
2820
select iterator,
2921
"Class " + iterator.getName() +

0 commit comments

Comments
 (0)