diff --git a/poincare/include/poincare/context.h b/poincare/include/poincare/context.h index 81ad82af8..bf686b3c9 100644 --- a/poincare/include/poincare/context.h +++ b/poincare/include/poincare/context.h @@ -15,10 +15,12 @@ class Context { virtual const Expression * expressionForSymbol(const Symbol * symbol); virtual const Expression * scalarExpressionForIndex(int index); void setExpressionForSymbolName(Expression * expression, const Symbol * symbol); + static constexpr uint16_t k_maxNumberOfScalarExpressions = 26; + static constexpr uint16_t k_maxNumberOfListExpressions = 10; + static constexpr uint16_t k_maxNumberOfMatrixExpressions = 10; private: int symbolIndex(const Symbol * symbol) const; - static constexpr uint16_t k_maxNumberOfExpressions = 26; - Expression * m_expressions[k_maxNumberOfExpressions]; + Expression * m_expressions[k_maxNumberOfScalarExpressions]; static Float * defaultExpression(); }; diff --git a/poincare/src/context.cpp b/poincare/src/context.cpp index 4b51f1bbc..e0d231938 100644 --- a/poincare/src/context.cpp +++ b/poincare/src/context.cpp @@ -3,7 +3,7 @@ Context::Context() { - for (int i = 0; i < k_maxNumberOfExpressions; i++) { + for (int i = 0; i < k_maxNumberOfScalarExpressions; i++) { m_expressions[i] = nullptr; } } @@ -20,7 +20,7 @@ int Context::symbolIndex(const Symbol * symbol) const { const Expression * Context::expressionForSymbol(const Symbol * symbol) { int index = symbolIndex(symbol); - if (index < 0 || index >= k_maxNumberOfExpressions) { + if (index < 0 || index >= k_maxNumberOfScalarExpressions) { return nullptr; } if (m_expressions[index] == nullptr) { @@ -30,7 +30,7 @@ const Expression * Context::expressionForSymbol(const Symbol * symbol) { } const Expression * Context::scalarExpressionForIndex(int index) { - assert(index < k_maxNumberOfExpressions); + assert(index < k_maxNumberOfScalarExpressions); return m_expressions[index]; }