BinaryOpNode::findConstantEquations(): fix bug related to nested if/else
In the absence of braces, the last “else” clause is always associated with the closest “if”, which is not what was intended here. The indentation was misleading.issue#70
parent
a4ef5a01d3
commit
1a08cdf01a
|
@ -5949,10 +5949,12 @@ void
|
|||
BinaryOpNode::findConstantEquations(map<VariableNode *, NumConstNode *> &table) const
|
||||
{
|
||||
if (op_code == BinaryOpcode::equal)
|
||||
if (dynamic_cast<VariableNode *>(arg1) && dynamic_cast<NumConstNode *>(arg2))
|
||||
table[dynamic_cast<VariableNode *>(arg1)] = dynamic_cast<NumConstNode *>(arg2);
|
||||
else if (dynamic_cast<VariableNode *>(arg2) && dynamic_cast<NumConstNode *>(arg1))
|
||||
table[dynamic_cast<VariableNode *>(arg2)] = dynamic_cast<NumConstNode *>(arg1);
|
||||
{
|
||||
if (dynamic_cast<VariableNode *>(arg1) && dynamic_cast<NumConstNode *>(arg2))
|
||||
table[dynamic_cast<VariableNode *>(arg1)] = dynamic_cast<NumConstNode *>(arg2);
|
||||
else if (dynamic_cast<VariableNode *>(arg2) && dynamic_cast<NumConstNode *>(arg1))
|
||||
table[dynamic_cast<VariableNode *>(arg2)] = dynamic_cast<NumConstNode *>(arg1);
|
||||
}
|
||||
else
|
||||
{
|
||||
arg1->findConstantEquations(table);
|
||||
|
|
Loading…
Reference in New Issue