Fixed issue with multiple negations.

This commit is contained in:
Patrick Lühne 2016-09-03 00:25:58 +02:00
parent 63de1891af
commit da88a8816c

View File

@ -47,13 +47,16 @@ ExpressionPointer Not::normalize()
{ {
BOOST_ASSERT(m_argumentStorage); BOOST_ASSERT(m_argumentStorage);
// Remove double negations // Remove double negations immediately
if (m_argumentStorage->expressionType() == Expression::Type::Not) if (m_argumentStorage->expressionType() == Expression::Type::Not)
{ {
auto &argument = dynamic_cast<Not &>(*m_argumentStorage); auto &argument = dynamic_cast<Not &>(*m_argumentStorage);
auto normalized = std::move(argument.m_argumentStorage); auto normalized = std::move(argument.m_argumentStorage);
normalized->normalize(); auto normalizedInner = normalized->normalize();
if (normalizedInner)
return normalizedInner;
return normalized; return normalized;
} }