mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare/symbol_abstract] No need to clone the expression for a Function
Already cloned in the global context.
This commit is contained in:
committed by
Léa Saviot
parent
fc392d4e81
commit
b728fb8a1b
@@ -125,7 +125,7 @@ Expression Function::shallowReduce(ExpressionNode::ReductionContext reductionCon
|
||||
}
|
||||
|
||||
Expression Function::deepReplaceReplaceableSymbols(Context * context, bool * didReplace) {
|
||||
Expression e = context->expressionForSymbolAbstract(*this, true);
|
||||
Expression e = context->expressionForSymbolAbstract(*this, false);
|
||||
if (e.isUninitialized()) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -57,10 +57,7 @@ bool SymbolAbstract::matches(const SymbolAbstract & symbol, ExpressionTest test,
|
||||
}
|
||||
|
||||
Expression SymbolAbstract::Expand(const SymbolAbstract & symbol, Context * context, bool clone) {
|
||||
bool isFunction = symbol.type() == ExpressionNode::Type::Function;
|
||||
/* Always clone the expression for Function because we are going to alter e
|
||||
* by replacing all UnknownX in it. */
|
||||
Expression e = context->expressionForSymbolAbstract(symbol, clone || isFunction);
|
||||
Expression e = context->expressionForSymbolAbstract(symbol, clone);
|
||||
/* Replace all the symbols iteratively. This prevents a memory failure when
|
||||
* symbols are defined circularly. */
|
||||
e = Expression::ExpressionWithoutSymbols(e, context);
|
||||
|
||||
Reference in New Issue
Block a user