From a20e6ee2ed505b1f1f1d8c8e75cee1188aba0082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 1 Dec 2017 14:09:10 +0100 Subject: [PATCH] [poincare] Enable interrupting some methods in Simplify that are called recursively Change-Id: I5b8c0de51617a3a36b3c8bc673de66dc60e74483 --- poincare/src/expression.cpp | 6 ++++++ poincare/src/power.cpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index 64045703e..4e8e4f4e0 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -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); } } diff --git a/poincare/src/power.cpp b/poincare/src/power.cpp index a81e2520a..155065413 100644 --- a/poincare/src/power.cpp +++ b/poincare/src/power.cpp @@ -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; }