If a switch-node is a branch of a condition node, whose other branch has a possible case-condition, then we add it as a case-node if the switch-node has no reaching-condition (or a simple if-cond before).
However, if this condition is always fulfilled if the new case-condition is fulfilled, we could still add the case node.
Consider the following AST for an illustration:
Here, node 4 is a case-node of the switch node, but we do not add it because the switch-node has a reaching-condition.
However, the reaching-condition var_0 !=2 is always true, if the case condition var_0 == 1 is fulfilled. Thus we could add it.
Approach
Update the missing-case finder for conditions such that it also handles this for switch-nodes with a reaching condition or a simple if-before.
Add the missing-case node only if the case-condtion implies the reaching-condition.
Proposal
If a switch-node is a branch of a condition node, whose other branch has a possible case-condition, then we add it as a case-node if the switch-node has no reaching-condition (or a simple if-cond before). However, if this condition is always fulfilled if the new case-condition is fulfilled, we could still add the case node.
Consider the following AST for an illustration: Here, node 4 is a case-node of the switch node, but we do not add it because the switch-node has a reaching-condition. However, the reaching-condition
var_0 !=2
is always true, if the case conditionvar_0 == 1
is fulfilled. Thus we could add it.Approach
Update the missing-case finder for conditions such that it also handles this for switch-nodes with a reaching condition or a simple if-before. Add the missing-case node only if the
case-condtion
implies the reaching-condition.