mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Python: just use ListElementContent for iterables
This commit is contained in:
@@ -179,33 +179,10 @@ private predicate synthDictSplatArgumentNodeStoreStep(
|
||||
* data from `x.name` is stored into the `yield` (and can subsequently be read out of the iterable).
|
||||
*/
|
||||
predicate yieldStoreStep(Node nodeFrom, Content c, Node nodeTo) {
|
||||
exists(Yield yield, Function func |
|
||||
exists(Yield yield |
|
||||
nodeTo.asCfgNode() = yield.getAFlowNode() and
|
||||
nodeFrom.asCfgNode() = yield.getValue().getAFlowNode() and
|
||||
func.containsInScope(yield)
|
||||
|
|
||||
exists(Comp comp | func = comp.getFunction() |
|
||||
(
|
||||
comp instanceof ListComp or
|
||||
comp instanceof GeneratorExp
|
||||
) and
|
||||
c instanceof ListElementContent
|
||||
or
|
||||
comp instanceof SetComp and
|
||||
c instanceof SetElementContent
|
||||
or
|
||||
comp instanceof DictComp and
|
||||
c instanceof DictionaryElementAnyContent
|
||||
)
|
||||
or
|
||||
not exists(Comp comp | func = comp.getFunction()) and
|
||||
(
|
||||
c instanceof ListElementContent
|
||||
or
|
||||
c instanceof SetElementContent
|
||||
or
|
||||
c instanceof DictionaryElementAnyContent
|
||||
)
|
||||
c instanceof ListElementContent
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -4224,6 +4224,10 @@ module StdlibPrivate {
|
||||
preservesValue = true
|
||||
)
|
||||
or
|
||||
input = "Argument[0].ListElement.TupleElement[1]" and
|
||||
output = "ReturnValue.DictionaryElementAny" and
|
||||
preservesValue = true
|
||||
or
|
||||
exists(DataFlow::DictionaryElementContent dc, string key | key = dc.getKey() |
|
||||
input = "Argument[" + key + ":]" and
|
||||
output = "ReturnValue.DictionaryElement[" + key + "]" and
|
||||
|
||||
Reference in New Issue
Block a user