[poincare/expression] Return undef if simplification interrupted

Without this change, we would get weird "reduced" expression, such as
multiplication(undef, _s), but we do not always check
sSimplificationHasBeenInterrupted afterwards.
This commit is contained in:
Léa Saviot
2020-07-28 17:07:22 +02:00
committed by EmilieNumworks
parent 5c75cc55d3
commit f3628f368f

View File

@@ -817,7 +817,11 @@ Expression Expression::angleUnitToRadian(Preferences::AngleUnit angleUnit) {
Expression Expression::reduce(ExpressionNode::ReductionContext reductionContext) {
sSimplificationHasBeenInterrupted = false;
return deepReduce(reductionContext);
Expression result = deepReduce(reductionContext);
if (sSimplificationHasBeenInterrupted) {
return replaceWithUndefinedInPlace();
}
return result;
}
Expression Expression::deepReduce(ExpressionNode::ReductionContext reductionContext) {