[poincare] Replace functions when replacing symbols iteratively

This commit is contained in:
Léa Saviot
2018-11-09 14:22:14 +01:00
committed by Émilie Feral
parent cb88dbc0a1
commit 17eaadb280
2 changed files with 17 additions and 2 deletions

View File

@@ -73,6 +73,10 @@ Expression FunctionNode::shallowReduce(Context & context, Preferences::AngleUnit
return Function(this).shallowReduce(context, angleUnit, replaceSymbols); // This uses Symbol::shallowReduce
}
Expression FunctionNode::replaceReplaceableSymbols(Context & context) {
return Function(this).replaceReplaceableSymbols(context);
}
Evaluation<float> FunctionNode::approximate(SinglePrecision p, Context& context, Preferences::AngleUnit angleUnit) const {
return templatedApproximate<float>(context, angleUnit);
}
@@ -134,4 +138,13 @@ Expression Function::shallowReduce(Context & context, Preferences::AngleUnit ang
return *this;
}
Expression Function::replaceReplaceableSymbols(Context & context) {
Expression e = context.expressionForSymbol(*this);
if (e.isUninitialized()) {
return *this;
}
replaceWithInPlace(e);
return e;
}
}