[poincare] Un-inline Symbol and Function UntypedBuilder

This commit is contained in:
Émilie Feral
2019-02-21 10:47:39 +01:00
committed by LeaNumworks
parent 24c9617a89
commit 8ca4094e13
4 changed files with 22 additions and 17 deletions

View File

@@ -100,6 +100,16 @@ Function Function::Builder(const char * name, size_t length, Expression child) {
return f;
}
Expression Function::UntypedBuilder(const char * name, size_t length, Expression child, Context * context) {
/* Create an expression only if it is not in the context or defined as a
* function */
Function f = Function::Builder(name, length, child);
if (SymbolAbstract::ValidInContext(f, context)) {
return f;
}
return Expression();
}
Expression Function::replaceSymbolWithExpression(const SymbolAbstract & symbol, const Expression & expression) {
// Replace the symbol in the child
childAtIndex(0).replaceSymbolWithExpression(symbol, expression);