[poincare] VariableContext::expressionForSymbol returns a clone of its

kept value to unable any modification of its value (without calling
setExpressionForSymbol).

All contexts::expressionForSymbol return new Expression that can be tempered with.
This commit is contained in:
Émilie Feral
2018-11-16 13:31:29 +01:00
parent a6ad7484a0
commit 55048ab907

View File

@@ -31,7 +31,7 @@ void VariableContext::setExpressionForSymbol(const Expression & expression, cons
const Expression VariableContext::expressionForSymbol(const SymbolAbstract & symbol) {
if (strcmp(symbol.name(), m_name) == 0) {
return m_value;
return m_value.clone();
} else {
return m_parentContext->expressionForSymbol(symbol);
}