[poincare] Parenthesis simplify

Change-Id: I2ebcc1d5148eacb087be407559e5593c6ac6641e
This commit is contained in:
Émilie Feral
2017-10-05 18:02:38 +02:00
parent e29872789c
commit 6533e115ec
2 changed files with 6 additions and 0 deletions

View File

@@ -16,6 +16,8 @@ private:
Evaluation<float> * privateEvaluate(SinglePrecision p, Context& context, AngleUnit angleUnit) const override { return templatedEvaluate<float>(context, angleUnit); }
Evaluation<double> * privateEvaluate(DoublePrecision p, Context& context, AngleUnit angleUnit) const override { return templatedEvaluate<double>(context, angleUnit); }
template<typename T> Evaluation<T> * templatedEvaluate(Context& context, AngleUnit angleUnit) const;
/* Simplification */
void privateSimplify() override;
};
}

View File

@@ -23,6 +23,10 @@ ExpressionLayout * Parenthesis::privateCreateLayout(FloatDisplayMode floatDispla
return new ParenthesisLayout(operand(0)->createLayout(floatDisplayMode, complexFormat));
}
void Parenthesis::privateSimplify() {
replaceWith(const_cast<Expression *>(operand(0)), true);
}
template<typename T>
Evaluation<T> * Parenthesis::templatedEvaluate(Context& context, AngleUnit angleUnit) const {
return operand(0)->evaluate<T>(context, angleUnit);