[poincare] When storing a function, replace unknownX by user's variable

This commit is contained in:
Léa Saviot
2018-11-09 13:58:18 +01:00
committed by Émilie Feral
parent 71ba760b71
commit 23895f40e2

View File

@@ -78,8 +78,15 @@ Expression Store::shallowReduce(Context & context, Preferences::AngleUnit angleU
if (e.isUninitialized()) {
return Undefined();
}
if (symbol().type() == ExpressionNode::Type::Function) {
// Replace the xUnknown symbol with the variable initially used
assert(symbol().childAtIndex(0).type() == ExpressionNode::Type::Symbol);
Expression userDefinedUnknown = symbol().childAtIndex(0);
Symbol xUnknown = Symbol(Symbol::SpecialSymbols::UnknownX);
e = e.replaceSymbolWithExpression(xUnknown, static_cast<Symbol &>(userDefinedUnknown));
}
replaceWithInPlace(e);
return e.shallowReduce(context, angleUnit, replaceSymbols);
return e;
}
}