[Context] Modifying context method signature for sequences

This allows sequences to be used in functions by calling u(x)

Change-Id: I336e84a19bf9b3dd0f2e435d1aaebda3c9e71ec8
This commit is contained in:
Arthur Camouseigt
2020-09-10 16:19:14 +02:00
committed by Émilie Feral
parent 3dca515441
commit 1d71a14d2c
13 changed files with 30 additions and 21 deletions

View File

@@ -23,14 +23,18 @@ void VariableContext::setExpressionForSymbolAbstract(const Expression & expressi
}
}
const Expression VariableContext::expressionForSymbolAbstract(const SymbolAbstract & symbol, bool clone) {
const Expression VariableContext::expressionForSymbolAbstract(const SymbolAbstract & symbol, bool clone, float unknownSymbolValue ) {
if (m_name != nullptr && strcmp(symbol.name(), m_name) == 0) {
if (symbol.type() == ExpressionNode::Type::Symbol) {
return clone ? m_value.clone() : m_value;
}
return Undefined::Builder();
} else {
return ContextWithParent::expressionForSymbolAbstract(symbol, clone);
Symbol unknownSymbol = Symbol::Builder(UCodePointUnknown);
if (m_name != nullptr && strcmp(m_name, unknownSymbol.name()) == 0) {
unknownSymbolValue = m_value.approximateToScalar<float>(this, Preferences::sharedPreferences()->complexFormat(),Preferences::sharedPreferences()->angleUnit());
}
return ContextWithParent::expressionForSymbolAbstract(symbol, clone, unknownSymbolValue);
}
}