mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 22:00:28 +01:00
[poincare] Align implementation of shallowReduce in Symbol and Function
This commit is contained in:
committed by
Léa Saviot
parent
70c9d063a2
commit
95c7235831
@@ -112,16 +112,16 @@ Expression Function::replaceSymbolWithExpression(const SymbolAbstract & symbol,
|
||||
}
|
||||
|
||||
Expression Function::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
|
||||
Function f(*this);
|
||||
Expression e = SymbolAbstract::Expand(f, reductionContext.context(), true);
|
||||
if (!e.isUninitialized()) {
|
||||
replaceWithInPlace(e);
|
||||
return e.deepReduce(reductionContext);
|
||||
Expression result = SymbolAbstract::Expand(*this, reductionContext.context(), true);
|
||||
if (result.isUninitialized()) {
|
||||
if (reductionContext.symbolicComputation()) {
|
||||
return *this;
|
||||
}
|
||||
result = Undefined::Builder();
|
||||
}
|
||||
if (!reductionContext.symbolicComputation()) {
|
||||
return replaceWithUndefinedInPlace();
|
||||
}
|
||||
return *this;
|
||||
replaceWithInPlace(result);
|
||||
// The stored expression is as entered by the user, so we need to call reduce
|
||||
return result.deepReduce(reductionContext);
|
||||
}
|
||||
|
||||
Expression Function::deepReplaceReplaceableSymbols(Context * context, bool * didReplace) {
|
||||
|
||||
@@ -175,8 +175,7 @@ Expression Symbol::shallowReduce(ExpressionNode::ReductionContext reductionConte
|
||||
}
|
||||
}
|
||||
|
||||
Symbol s = *this;
|
||||
Expression result = SymbolAbstract::Expand(s, reductionContext.context(), true);
|
||||
Expression result = SymbolAbstract::Expand(*this, reductionContext.context(), true);
|
||||
if (result.isUninitialized()) {
|
||||
if (reductionContext.symbolicComputation()) {
|
||||
return *this;
|
||||
|
||||
Reference in New Issue
Block a user