Implemented removal of double negations.

This commit is contained in:
Patrick Lühne 2016-09-02 18:07:37 +02:00
parent 56ce55677f
commit b084a1f727

View File

@ -47,6 +47,14 @@ ExpressionPointer Not::normalize()
{ {
BOOST_ASSERT(m_argumentStorage); BOOST_ASSERT(m_argumentStorage);
// Remove double negations
if (m_argumentStorage->expressionType() == Expression::Type::Not)
{
auto &argument = dynamic_cast<Not &>(*m_argumentStorage);
return std::move(argument.m_argumentStorage);
}
auto normalizedArgument = m_argumentStorage->normalize(); auto normalizedArgument = m_argumentStorage->normalize();
// Replace argument if changed by normalization // Replace argument if changed by normalization