[poincare] Use new API in AbsoluteValue

This commit is contained in:
Léa Saviot
2018-08-31 14:09:10 +02:00
parent cb9b498c9f
commit 9601dad2dc
2 changed files with 10 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ namespace Poincare {
class Context;
class Expression : public TreeByReference {
friend class AbsoluteValue;
friend class CosineNode;
friend class SineNode;
friend class ExpressionNode;

View File

@@ -43,19 +43,22 @@ Expression AbsoluteValue::shallowReduce(Context & context, Preferences::AngleUni
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression op = childAtIndex(0);
Expression c = childAtIndex(0);
#if MATRIX_EXACT_REDUCING
#if 0
if (op->type() == Type::Matrix) {
if (c->type() == Type::Matrix) {
return SimplificationHelper::Map(this, context, angleUnit);
}
#endif
#endif
if (op.sign() == ExpressionNode::Sign::Positive) {
return op;
if (c.sign() == ExpressionNode::Sign::Positive) {
replaceWithInPlace(c);
return c;
}
if (op.sign() == ExpressionNode::Sign::Negative) {
return op.setSign(ExpressionNode::Sign::Positive, context, angleUnit);
if (c.sign() == ExpressionNode::Sign::Negative) {
Expression result = c.setSign(ExpressionNode::Sign::Positive, context, angleUnit);
replaceWithInPlace(result);
return result;
}
return *this;
}