Python: Rewrite StringConstCompare to use IterableNode

This commit is contained in:
Rasmus Wriedt Larsen
2020-11-27 13:37:03 +01:00
parent 098f8c4f21
commit e6319e5d84

View File

@@ -19,24 +19,15 @@ class StringConstCompare extends DataFlow::BarrierGuard, CompareNode {
this.operands(checked_node, op, str_const.getAFlowNode())
)
or
exists(ControlFlowNode str_const_iterable, Cmpop op |
exists(IterableNode str_const_iterable, Cmpop op |
op = any(In in_) and safe_branch = true
or
op = any(NotIn ni) and safe_branch = false
|
this.operands(checked_node, op, str_const_iterable) and
(
str_const_iterable instanceof SequenceNode
or
str_const_iterable instanceof SetNode
) and
forall(ControlFlowNode elem |
elem = str_const_iterable.(SequenceNode).getAnElement()
or
elem = str_const_iterable.(SetNode).getAnElement()
|
forall(ControlFlowNode elem | elem = str_const_iterable.getAnElement() |
elem.getNode() instanceof StrConst
)
) and
this.operands(checked_node, op, str_const_iterable)
)
}