From 6533e115ece265121ffb39212fc34fb80917062a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 5 Oct 2017 18:02:38 +0200 Subject: [PATCH] [poincare] Parenthesis simplify Change-Id: I2ebcc1d5148eacb087be407559e5593c6ac6641e --- poincare/include/poincare/parenthesis.h | 2 ++ poincare/src/parenthesis.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/poincare/include/poincare/parenthesis.h b/poincare/include/poincare/parenthesis.h index 7668e86a1..047a05d61 100644 --- a/poincare/include/poincare/parenthesis.h +++ b/poincare/include/poincare/parenthesis.h @@ -16,6 +16,8 @@ private: Evaluation * privateEvaluate(SinglePrecision p, Context& context, AngleUnit angleUnit) const override { return templatedEvaluate(context, angleUnit); } Evaluation * privateEvaluate(DoublePrecision p, Context& context, AngleUnit angleUnit) const override { return templatedEvaluate(context, angleUnit); } template Evaluation * templatedEvaluate(Context& context, AngleUnit angleUnit) const; + /* Simplification */ + void privateSimplify() override; }; } diff --git a/poincare/src/parenthesis.cpp b/poincare/src/parenthesis.cpp index ac7d8b157..ec0912710 100644 --- a/poincare/src/parenthesis.cpp +++ b/poincare/src/parenthesis.cpp @@ -23,6 +23,10 @@ ExpressionLayout * Parenthesis::privateCreateLayout(FloatDisplayMode floatDispla return new ParenthesisLayout(operand(0)->createLayout(floatDisplayMode, complexFormat)); } +void Parenthesis::privateSimplify() { + replaceWith(const_cast(operand(0)), true); +} + template Evaluation * Parenthesis::templatedEvaluate(Context& context, AngleUnit angleUnit) const { return operand(0)->evaluate(context, angleUnit);