diff --git a/poincare/src/absolute_value.cpp b/poincare/src/absolute_value.cpp index dc39afeba..963fc570a 100644 --- a/poincare/src/absolute_value.cpp +++ b/poincare/src/absolute_value.cpp @@ -28,8 +28,8 @@ LayoutRef AbsoluteValue::createLayout(Preferences::PrintFloatMode floatDisplayMo } Expression AbsoluteValue::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/arc_sine.cpp b/poincare/src/arc_sine.cpp index 41619b0df..48172e440 100644 --- a/poincare/src/arc_sine.cpp +++ b/poincare/src/arc_sine.cpp @@ -18,8 +18,8 @@ Expression * ArcSine::clone() const { } Expression ArcSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/arc_tangent.cpp b/poincare/src/arc_tangent.cpp index 55fbd2f85..2bd359ffa 100644 --- a/poincare/src/arc_tangent.cpp +++ b/poincare/src/arc_tangent.cpp @@ -18,8 +18,8 @@ Expression * ArcTangent::clone() const { } Expression ArcTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/binomial_coefficient.cpp b/poincare/src/binomial_coefficient.cpp index 0cf02ec11..54053b2a3 100644 --- a/poincare/src/binomial_coefficient.cpp +++ b/poincare/src/binomial_coefficient.cpp @@ -21,8 +21,8 @@ Expression * BinomialCoefficient::clone() const { } Expression BinomialCoefficient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op0 = editableOperand(0); diff --git a/poincare/src/ceiling.cpp b/poincare/src/ceiling.cpp index 1bb2e52d6..41f1cd654 100644 --- a/poincare/src/ceiling.cpp +++ b/poincare/src/ceiling.cpp @@ -21,8 +21,8 @@ Expression * Ceiling::clone() const { } Expression Ceiling::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/complex_argument.cpp b/poincare/src/complex_argument.cpp index dbe15c412..cea8571ad 100644 --- a/poincare/src/complex_argument.cpp +++ b/poincare/src/complex_argument.cpp @@ -17,8 +17,8 @@ Expression * ComplexArgument::clone() const { } Expression ComplexArgument::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/confidence_interval.cpp b/poincare/src/confidence_interval.cpp index 44b192c87..edaedc0d5 100644 --- a/poincare/src/confidence_interval.cpp +++ b/poincare/src/confidence_interval.cpp @@ -25,8 +25,8 @@ int ConfidenceInterval::polynomialDegree(char symbolName) const { } Expression ConfidenceInterval::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op0 = editableOperand(0); diff --git a/poincare/src/conjugate.cpp b/poincare/src/conjugate.cpp index e29c9b54e..e09000577 100644 --- a/poincare/src/conjugate.cpp +++ b/poincare/src/conjugate.cpp @@ -20,8 +20,8 @@ LayoutRef Conjugate::createLayout(Preferences::PrintFloatMode floatDisplayMode, } Expression Conjugate::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/determinant.cpp b/poincare/src/determinant.cpp index 901a35546..4c4420f37 100644 --- a/poincare/src/determinant.cpp +++ b/poincare/src/determinant.cpp @@ -17,8 +17,8 @@ Expression * Determinant::clone() const { } Expression Determinant::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/division_quotient.cpp b/poincare/src/division_quotient.cpp index bbfddc129..f38e2fa57 100644 --- a/poincare/src/division_quotient.cpp +++ b/poincare/src/division_quotient.cpp @@ -19,8 +19,8 @@ Expression * DivisionQuotient::clone() const { } Expression DivisionQuotient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op0 = editableOperand(0); diff --git a/poincare/src/division_remainder.cpp b/poincare/src/division_remainder.cpp index 10cadf344..94949ffa8 100644 --- a/poincare/src/division_remainder.cpp +++ b/poincare/src/division_remainder.cpp @@ -19,8 +19,8 @@ Expression * DivisionRemainder::clone() const { } Expression DivisionRemainder::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op0 = editableOperand(0); diff --git a/poincare/src/equal.cpp b/poincare/src/equal.cpp index 5c5c47835..efd59d546 100644 --- a/poincare/src/equal.cpp +++ b/poincare/src/equal.cpp @@ -39,8 +39,8 @@ Expression * Equal::standardEquation(Context & context, Preferences::AngleUnit a } Expression Equal::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } if (operand(0)->isIdenticalTo(operand(1))) { diff --git a/poincare/src/factorial.cpp b/poincare/src/factorial.cpp index 5b8f4b7af..618235e18 100644 --- a/poincare/src/factorial.cpp +++ b/poincare/src/factorial.cpp @@ -37,8 +37,8 @@ bool Factorial::needsParenthesesWithParent(const SerializationHelperInterface * /* Simplification */ Expression Factorial::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/floor.cpp b/poincare/src/floor.cpp index 074846278..6336fdd5a 100644 --- a/poincare/src/floor.cpp +++ b/poincare/src/floor.cpp @@ -21,8 +21,8 @@ Expression * Floor::clone() const { } Expression Floor::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/frac_part.cpp b/poincare/src/frac_part.cpp index 92c444347..397ee7418 100644 --- a/poincare/src/frac_part.cpp +++ b/poincare/src/frac_part.cpp @@ -18,8 +18,8 @@ Expression * FracPart::clone() const { } Expression FracPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/great_common_divisor.cpp b/poincare/src/great_common_divisor.cpp index 4837b5b13..d901d12ee 100644 --- a/poincare/src/great_common_divisor.cpp +++ b/poincare/src/great_common_divisor.cpp @@ -20,8 +20,8 @@ Expression * GreatCommonDivisor::clone() const { } Expression GreatCommonDivisor::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op0 = editableOperand(0); diff --git a/poincare/src/hyperbolic_arc_cosine.cpp b/poincare/src/hyperbolic_arc_cosine.cpp index 750d9e86f..5ce61e7f2 100644 --- a/poincare/src/hyperbolic_arc_cosine.cpp +++ b/poincare/src/hyperbolic_arc_cosine.cpp @@ -18,8 +18,8 @@ Expression * HyperbolicArcCosine::clone() const { } Expression HyperbolicArcCosine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/hyperbolic_arc_sine.cpp b/poincare/src/hyperbolic_arc_sine.cpp index 7bee6bde6..6351ee67d 100644 --- a/poincare/src/hyperbolic_arc_sine.cpp +++ b/poincare/src/hyperbolic_arc_sine.cpp @@ -18,8 +18,8 @@ Expression * HyperbolicArcSine::clone() const { } Expression HyperbolicArcSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/hyperbolic_arc_tangent.cpp b/poincare/src/hyperbolic_arc_tangent.cpp index 539ff09e8..1752b7d36 100644 --- a/poincare/src/hyperbolic_arc_tangent.cpp +++ b/poincare/src/hyperbolic_arc_tangent.cpp @@ -18,8 +18,8 @@ Expression * HyperbolicArcTangent::clone() const { } Expression HyperbolicArcTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/hyperbolic_cosine.cpp b/poincare/src/hyperbolic_cosine.cpp index 27ed1ffac..be1f400b5 100644 --- a/poincare/src/hyperbolic_cosine.cpp +++ b/poincare/src/hyperbolic_cosine.cpp @@ -22,8 +22,8 @@ Expression * HyperbolicCosine::clone() const { } Expression HyperbolicCosine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/hyperbolic_sine.cpp b/poincare/src/hyperbolic_sine.cpp index d98bcd246..2cd2a8218 100644 --- a/poincare/src/hyperbolic_sine.cpp +++ b/poincare/src/hyperbolic_sine.cpp @@ -22,8 +22,8 @@ Expression * HyperbolicSine::clone() const { } Expression HyperbolicSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/hyperbolic_tangent.cpp b/poincare/src/hyperbolic_tangent.cpp index ca2fdf6bc..370f5946e 100644 --- a/poincare/src/hyperbolic_tangent.cpp +++ b/poincare/src/hyperbolic_tangent.cpp @@ -21,8 +21,8 @@ Expression * HyperbolicTangent::clone() const { } Expression HyperbolicTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/imaginary_part.cpp b/poincare/src/imaginary_part.cpp index 6fe8c9326..00b747ff5 100644 --- a/poincare/src/imaginary_part.cpp +++ b/poincare/src/imaginary_part.cpp @@ -19,8 +19,8 @@ Expression * ImaginaryPart::clone() const { Expression ImaginaryPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/integral.cpp b/poincare/src/integral.cpp index ea6f02699..da19ca6db 100644 --- a/poincare/src/integral.cpp +++ b/poincare/src/integral.cpp @@ -32,8 +32,8 @@ int Integral::polynomialDegree(char symbolName) const { } Expression Integral::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/least_common_multiple.cpp b/poincare/src/least_common_multiple.cpp index f69f6ce69..6f8fa0511 100644 --- a/poincare/src/least_common_multiple.cpp +++ b/poincare/src/least_common_multiple.cpp @@ -20,8 +20,8 @@ Expression * LeastCommonMultiple::clone() const { } Expression LeastCommonMultiple::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op0 = editableOperand(0); diff --git a/poincare/src/matrix_dimension.cpp b/poincare/src/matrix_dimension.cpp index d938ea874..74d617f91 100644 --- a/poincare/src/matrix_dimension.cpp +++ b/poincare/src/matrix_dimension.cpp @@ -17,8 +17,8 @@ Expression * MatrixDimension::clone() const { } Expression MatrixDimension::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING diff --git a/poincare/src/matrix_inverse.cpp b/poincare/src/matrix_inverse.cpp index a4a537903..a4de76750 100644 --- a/poincare/src/matrix_inverse.cpp +++ b/poincare/src/matrix_inverse.cpp @@ -20,8 +20,8 @@ Expression * MatrixInverse::clone() const { } Expression MatrixInverse::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/matrix_trace.cpp b/poincare/src/matrix_trace.cpp index 37bd5bbb6..a867b2c7a 100644 --- a/poincare/src/matrix_trace.cpp +++ b/poincare/src/matrix_trace.cpp @@ -19,8 +19,8 @@ Expression * MatrixTrace::clone() const { } Expression MatrixTrace::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/matrix_transpose.cpp b/poincare/src/matrix_transpose.cpp index 157a448a0..6b61866ca 100644 --- a/poincare/src/matrix_transpose.cpp +++ b/poincare/src/matrix_transpose.cpp @@ -18,8 +18,8 @@ Expression * MatrixTranspose::clone() const { } Expression MatrixTranspose::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/permute_coefficient.cpp b/poincare/src/permute_coefficient.cpp index 94b04c382..1ac6e9331 100644 --- a/poincare/src/permute_coefficient.cpp +++ b/poincare/src/permute_coefficient.cpp @@ -19,8 +19,8 @@ Expression * PermuteCoefficient::clone() const { } Expression PermuteCoefficient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op0 = editableOperand(0); diff --git a/poincare/src/prediction_interval.cpp b/poincare/src/prediction_interval.cpp index 46f400671..84e8cf422 100644 --- a/poincare/src/prediction_interval.cpp +++ b/poincare/src/prediction_interval.cpp @@ -26,8 +26,8 @@ int PredictionInterval::polynomialDegree(char symbolName) const { } Expression PredictionInterval::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op0 = editableOperand(0); diff --git a/poincare/src/real_part.cpp b/poincare/src/real_part.cpp index 047fc6d50..f439c828e 100644 --- a/poincare/src/real_part.cpp +++ b/poincare/src/real_part.cpp @@ -17,8 +17,8 @@ Expression * RealPart::clone() const { } Expression RealPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } Expression * op = editableOperand(0); diff --git a/poincare/src/round.cpp b/poincare/src/round.cpp index a9a10f4ca..4ef980028 100644 --- a/poincare/src/round.cpp +++ b/poincare/src/round.cpp @@ -20,8 +20,8 @@ Expression * Round::clone() const { } Expression Round::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const { - Expression * e = Expression::defaultShallowReduce(context, angleUnit); - if (e != this) { + Expression e = Expression::defaultShallowReduce(context, angleUnit); + if (e.isUndefinedOrAllocationFailure()) { return e; } #if MATRIX_EXACT_REDUCING