mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Enable to call method on undefined Expression
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
#include <poincare/vertical_offset_layout_node.h>
|
||||
#else
|
||||
|
||||
#include <poincare/global_context.h>
|
||||
#include <poincare/addition.h>
|
||||
#include <poincare/matrix_complex.h>
|
||||
#include <poincare/multiplication.h>
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
bool isEqualToItsApproximationLayout(Expression approximation, int bufferSize, Preferences::AngleUnit angleUnit, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits, Context & context);
|
||||
|
||||
/* Layout Helper */
|
||||
LayoutRef createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { return this->node()->createLayout(floatDisplayMode, numberOfSignificantDigits); }
|
||||
LayoutRef createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { return isDefined() ? node()->createLayout(floatDisplayMode, numberOfSignificantDigits) : LayoutRef(); }
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const { return this->node()->serialize(buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits); }
|
||||
|
||||
/* Simplification */
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
using TreeByReference::operator==;
|
||||
using TreeByReference::operator!=;
|
||||
|
||||
LayoutReference(LayoutNode * node) :
|
||||
LayoutReference(LayoutNode * node = nullptr) :
|
||||
TreeByReference(node) {}
|
||||
|
||||
LayoutReference clone() const {
|
||||
|
||||
@@ -220,8 +220,11 @@ Expression Expression::deepBeautify(Context & context, Preferences::AngleUnit an
|
||||
|
||||
template<typename U>
|
||||
Expression Expression::approximate(Context& context, Preferences::AngleUnit angleUnit, Preferences::Preferences::ComplexFormat complexFormat) const {
|
||||
Evaluation<U> e = node()->approximate(U(), context, angleUnit);
|
||||
return e->complexToExpression(complexFormat);
|
||||
if (isDefined()) {
|
||||
Evaluation<U> e = node()->approximate(U(), context, angleUnit);
|
||||
return e->complexToExpression(complexFormat);
|
||||
}
|
||||
return Undefined();
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
|
||||
Reference in New Issue
Block a user