[poincare] Enable interrupting some methods in Simplify that are called

recursively

Change-Id: I5b8c0de51617a3a36b3c8bc673de66dc60e74483
This commit is contained in:
Émilie Feral
2017-12-01 14:09:10 +01:00
parent bd26c499e4
commit a20e6ee2ed
2 changed files with 9 additions and 0 deletions

View File

@@ -168,9 +168,15 @@ bool Expression::IsMatrix(const Expression * e) {
int Expression::SimplificationOrder(const Expression * e1, const Expression * e2) {
if (e1->type() > e2->type()) {
return -(e2->simplificationOrderGreaterType(e1));
if (shouldStopProcessing()) {
return 1;
}
} else if (e1->type() == e2->type()) {
return e1->simplificationOrderSameType(e2);
} else {
if (shouldStopProcessing()) {
return -1;
}
return e1->simplificationOrderGreaterType(e2);
}
}

View File

@@ -34,6 +34,9 @@ Expression * Power::clone() const {
}
Expression::Sign Power::sign() const {
if (shouldStopProcessing()) {
return Sign::Unknown;
}
if (operand(0)->sign() == Sign::Positive && operand(1)->sign() != Sign::Unknown) {
return Sign::Positive;
}