From 5750d005747c9cbb4b9250bb1bb61861087e38ab Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Wed, 18 Sep 2019 11:52:27 +0200 Subject: [PATCH] [apps/shared] Remove redundant call to isCircularlyDefined ExpressionModel::expressionReduced does already call isCircularlyDefined and returns undef if true. The isCircularlyDefined method is then made private. --- apps/shared/continuous_function.cpp | 2 +- apps/shared/expression_model.h | 4 +--- apps/shared/expression_model_handle.h | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/shared/continuous_function.cpp b/apps/shared/continuous_function.cpp index 6ce8aad6e..8ea2ca131 100644 --- a/apps/shared/continuous_function.cpp +++ b/apps/shared/continuous_function.cpp @@ -276,7 +276,7 @@ ContinuousFunction::RecordDataBuffer * ContinuousFunction::recordData() const { template Coordinate2D ContinuousFunction::templatedApproximateAtParameter(T t, Poincare::Context * context) const { - if (isCircularlyDefined(context) || t < tMin() || t > tMax()) { + if (t < tMin() || t > tMax()) { return Coordinate2D(plotType() == PlotType::Cartesian ? t : NAN, NAN); } constexpr int bufferSize = CodePoint::MaxCodePointCharLength + 1; diff --git a/apps/shared/expression_model.h b/apps/shared/expression_model.h index eef47590f..989432045 100644 --- a/apps/shared/expression_model.h +++ b/apps/shared/expression_model.h @@ -21,9 +21,6 @@ public: Ion::Storage::Record::ErrorStatus setContent(Ion::Storage::Record * record, const char * c, CodePoint symbol = 0); Ion::Storage::Record::ErrorStatus setExpressionContent(Ion::Storage::Record * record, const Poincare::Expression & newExpression); - // Property - bool isCircularlyDefined(const Ion::Storage::Record * record, Poincare::Context * context) const; - virtual void tidy() const; protected: // Setters helper @@ -34,6 +31,7 @@ private: virtual void updateNewDataWithExpression(Ion::Storage::Record * record, const Poincare::Expression & expressionToStore, void * expressionAddress, size_t expressionToStoreSize, size_t previousExpressionSize); virtual void * expressionAddress(const Ion::Storage::Record * record) const = 0; virtual size_t expressionSize(const Ion::Storage::Record * record) const = 0; + bool isCircularlyDefined(const Ion::Storage::Record * record, Poincare::Context * context) const; mutable int m_circular; }; diff --git a/apps/shared/expression_model_handle.h b/apps/shared/expression_model_handle.h index 585974c4d..7456ef3ad 100644 --- a/apps/shared/expression_model_handle.h +++ b/apps/shared/expression_model_handle.h @@ -16,7 +16,6 @@ public: void text(char * buffer, size_t bufferSize) const { return model()->text(this, buffer, bufferSize, symbol()); } virtual Poincare::Expression expressionReduced(Poincare::Context * context) const { return model()->expressionReduced(this, context); } Poincare::Expression expressionClone() const { return model()->expressionClone(this); } - bool isCircularlyDefined(Poincare::Context * context) const { return model()->isCircularlyDefined(this, context); } Poincare::Layout layout() { return model()->layout(this, symbol()); } /* Here, isDefined is the exact contrary of isEmpty. However, for Sequence * inheriting from ExpressionModelHandle, isEmpty and isDefined have not exactly