mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Node->isDefined becomes !Node->isUninitialized
This commit is contained in:
@@ -92,7 +92,7 @@ bool App::textInputIsCorrect(const char * text) {
|
||||
* less than k_printedExpressionLength characters. Otherwise, we prevent the
|
||||
* user from adding this expression to the calculation store. */
|
||||
Expression exp = Expression::parse(text);
|
||||
if (!exp.isDefined()) {
|
||||
if (exp.isUninitialized()) {
|
||||
return false;
|
||||
}
|
||||
exp = exp.replaceSymbolWithExpression(Symbol::SpecialSymbols::Ans, static_cast<Snapshot *>(snapshot())->calculationStore()->ansExpression(localContext()));
|
||||
|
||||
@@ -100,7 +100,7 @@ const char * Calculation::approximateOutputText() {
|
||||
}
|
||||
|
||||
Expression Calculation::input() {
|
||||
if (!m_input.isDefined()) {
|
||||
if (m_input.isUninitialized()) {
|
||||
m_input = Expression::parse(m_inputText);
|
||||
}
|
||||
return m_input;
|
||||
@@ -143,13 +143,13 @@ void Calculation::tidy() {
|
||||
}
|
||||
|
||||
Expression Calculation::exactOutput(Context * context) {
|
||||
if (!m_exactOutput.isDefined()) {
|
||||
if (m_exactOutput.isUninitialized()) {
|
||||
/* Because the angle unit might have changed, we do not simplify again. We
|
||||
* thereby avoid turning cos(Pi/4) into sqrt(2)/2 and displaying
|
||||
* 'sqrt(2)/2 = 0.999906' (which is totally wrong) instead of
|
||||
* 'cos(pi/4) = 0.999906' (which is true in degree). */
|
||||
m_exactOutput = Expression::parse(m_exactOutputText);
|
||||
if (!m_exactOutput.isDefined()) {
|
||||
if (m_exactOutput.isUninitialized()) {
|
||||
m_exactOutput = Undefined();
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ LayoutRef Calculation::createExactOutputLayout(Context * context) {
|
||||
}
|
||||
|
||||
Expression Calculation::approximateOutput(Context * context) {
|
||||
if (!m_approximateOutput.isDefined()) {
|
||||
if (m_approximateOutput.isUninitialized()) {
|
||||
/* To ensure that the expression 'm_output' is a matrix or a complex, we
|
||||
* call 'evaluate'. */
|
||||
Expression exp = Expression::parse(m_approximateOutputText);
|
||||
|
||||
@@ -154,11 +154,10 @@ bool EditExpressionController::inputViewDidReceiveEvent(Ion::Events::Event event
|
||||
|
||||
bool EditExpressionController::inputViewDidFinishEditing(const char * text, LayoutRef layoutR) {
|
||||
App * calculationApp = (App *)app();
|
||||
if (!layoutR.isDefined()) {
|
||||
if (layoutR.isUninitialized()) {
|
||||
assert(text);
|
||||
strlcpy(m_cacheBuffer, text, Calculation::k_printedExpressionSize);
|
||||
} else {
|
||||
assert(layoutR.isDefined());
|
||||
layoutR.serialize(m_cacheBuffer, Calculation::k_printedExpressionSize);
|
||||
}
|
||||
m_calculationStore->push(m_cacheBuffer, calculationApp->localContext());
|
||||
|
||||
@@ -100,7 +100,7 @@ void HistoryViewCell::setCalculation(Calculation * calculation) {
|
||||
/* Both output expressions have to be updated at the same time. Otherwise,
|
||||
* when updating one layout, if the second one still points to a deleted
|
||||
* layout, calling to layoutSubviews() would fail. */
|
||||
if (m_exactOutputLayout.isDefined()) {
|
||||
if (!m_exactOutputLayout.isUninitialized()) {
|
||||
m_exactOutputLayout = Poincare::LayoutRef();
|
||||
}
|
||||
if (!calculation->shouldOnlyDisplayApproximateOutput(calculationApp->localContext())) {
|
||||
|
||||
@@ -41,7 +41,7 @@ bool ExpressionFieldDelegateApp::layoutFieldDidReceiveEvent(LayoutField * layout
|
||||
displayWarning(I18n::Message::SyntaxError);
|
||||
return true;
|
||||
}
|
||||
if (!exp.isDefined()) {
|
||||
if (exp.isUninitialized()) {
|
||||
layoutField->app()->displayWarning(I18n::Message::SyntaxError);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ const char * ExpressionModel::text() const {
|
||||
}
|
||||
|
||||
Poincare::Expression ExpressionModel::expression(Poincare::Context * context) const {
|
||||
if (!m_expression.isDefined()) {
|
||||
if (m_expression.isUninitialized()) {
|
||||
m_expression = PoincareHelpers::ParseAndSimplify(m_text, *context);
|
||||
}
|
||||
return m_expression;
|
||||
}
|
||||
|
||||
LayoutRef ExpressionModel::layoutRef() {
|
||||
if (!m_layoutRef.isDefined()) {
|
||||
if (m_layoutRef.isUninitialized()) {
|
||||
Expression nonSimplifiedExpression = Expression::parse(m_text);
|
||||
m_layoutRef = PoincareHelpers::CreateLayout(nonSimplifiedExpression);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void ExpressionModel::setContent(const char * c) {
|
||||
* the m_layout and m_expression. */
|
||||
// TODO: the previous expression and layout are going to be destroyed as soon as we call expression(). Should we optimize this?
|
||||
#if 0
|
||||
if (m_layoutRef.isDefined()) {
|
||||
if (!m_layoutRef.isUninitialized()) {
|
||||
m_layoutRef = LayoutRef();
|
||||
}
|
||||
if (m_expression != nullptr) {
|
||||
@@ -66,7 +66,7 @@ void ExpressionModel::tidy() {
|
||||
m_expression = Expression(); ?
|
||||
|
||||
|
||||
if (m_layoutRef.isDefined()) {
|
||||
if (!m_layoutRef.isUninitialized()) {
|
||||
m_layoutRef = LayoutRef();
|
||||
}
|
||||
if (m_expression != nullptr) {
|
||||
|
||||
@@ -23,7 +23,7 @@ KDCoordinate ExpressionModelListController::expressionRowHeight(int j) {
|
||||
return Metric::StoreRowHeight;
|
||||
}
|
||||
ExpressionModel * m = modelStore()->modelAtIndex(j);
|
||||
if (!m->layoutRef().isDefined()) {
|
||||
if (m->layoutRef().isUninitialized()) {
|
||||
return Metric::StoreRowHeight;
|
||||
}
|
||||
KDCoordinate modelSize = m->layoutRef().layoutSize().height();
|
||||
|
||||
@@ -39,7 +39,7 @@ ExpressionModel * ExpressionModelStore::definedModelAtIndex(int i) {
|
||||
assert(i>=0 && i<m_numberOfModels);
|
||||
int index = 0;
|
||||
for (int k = 0; k < m_numberOfModels; k++) {
|
||||
if (modelAtIndex(k)->isDefined()) {
|
||||
if (!modelAtIndex(k)->isUninitialized()) {
|
||||
if (i == index) {
|
||||
return modelAtIndex(k);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ ExpressionModel * ExpressionModelStore::definedModelAtIndex(int i) {
|
||||
int ExpressionModelStore::numberOfDefinedModels() {
|
||||
int result = 0;
|
||||
for (int i = 0; i < m_numberOfModels; i++) {
|
||||
if (modelAtIndex(i)->isDefined()) {
|
||||
if (!modelAtIndex(i)->isUninitialized()) {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ Poincare::LayoutRef ScrollableExactApproximateExpressionsView::ContentCell::layo
|
||||
}
|
||||
|
||||
int ScrollableExactApproximateExpressionsView::ContentCell::numberOfSubviews() const {
|
||||
if (m_exactExpressionView.layoutRef().isDefined()) {
|
||||
return 3;
|
||||
if (m_exactExpressionView.layoutRef().isUninitialized()) {
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
return 3;
|
||||
}
|
||||
|
||||
View * ScrollableExactApproximateExpressionsView::ContentCell::subviewAtIndex(int index) {
|
||||
@@ -115,7 +115,7 @@ void ScrollableExactApproximateExpressionsView::setEqualMessage(I18n::Message eq
|
||||
}
|
||||
|
||||
void ScrollableExactApproximateExpressionsView::didBecomeFirstResponder() {
|
||||
if (!m_contentCell.exactExpressionView()->layoutRef().isDefined()) {
|
||||
if (m_contentCell.exactExpressionView()->layoutRef().isUninitialized()) {
|
||||
setSelectedSubviewType(SubviewType::ApproximativeOutput);
|
||||
} else {
|
||||
setSelectedSubviewType(SubviewType::ExactOutput);
|
||||
|
||||
@@ -73,7 +73,7 @@ bool StoreController::textFieldDidFinishEditing(TextField * textField, const cha
|
||||
if (textField == contentView()->formulaInputView()->textField()) {
|
||||
// Handle formula input
|
||||
Expression expression = Expression::parse(textField->text());
|
||||
if (!expression.isDefined()) {
|
||||
if (expression.isUninitialized()) {
|
||||
app()->displayWarning(I18n::Message::SyntaxError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ bool TextFieldDelegateApp::textFieldShouldFinishEditing(TextField * textField, I
|
||||
bool TextFieldDelegateApp::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
|
||||
if (textField->isEditing() && textField->textFieldShouldFinishEditing(event)) {
|
||||
Expression exp = Expression::parse(textField->text());
|
||||
if (!exp.isDefined()) {
|
||||
if (exp.isUninitialized()) {
|
||||
textField->app()->displayWarning(I18n::Message::SyntaxError);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ void VariableBoxController::ContentViewController::willDisplayCellForIndex(Highl
|
||||
return;
|
||||
}
|
||||
myCell->displayExpression(true);
|
||||
if (evaluation.isDefined()) {
|
||||
if (!evaluation.isUninitialized()) {
|
||||
/* TODO: implement list contexts */
|
||||
// TODO: handle matrix and scalar!
|
||||
LayoutRef layoutR = layoutRefForIndex(index);
|
||||
@@ -169,7 +169,7 @@ KDCoordinate VariableBoxController::ContentViewController::rowHeight(int index)
|
||||
return Metric::ToolboxRowHeight;
|
||||
}
|
||||
LayoutRef layoutR = layoutRefForIndex(index);
|
||||
if (layoutR.isDefined()) {
|
||||
if (!layoutR.isUninitialized()) {
|
||||
return layoutR.layoutSize().height()+k_leafMargin;
|
||||
}
|
||||
return Metric::ToolboxRowHeight;
|
||||
|
||||
@@ -42,7 +42,7 @@ int ExpressionView::numberOfLayouts() const {
|
||||
}
|
||||
|
||||
KDSize ExpressionView::minimalSizeForOptimalDisplay() const {
|
||||
if (!m_layoutRef.isDefined()) {
|
||||
if (m_layoutRef.isUninitialized()) {
|
||||
return KDSizeZero;
|
||||
}
|
||||
KDSize expressionSize = m_layoutRef.layoutSize();
|
||||
@@ -60,7 +60,7 @@ KDPoint ExpressionView::absoluteDrawingOrigin() const {
|
||||
|
||||
void ExpressionView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, m_backgroundColor);
|
||||
if (m_layoutRef.isDefined()) {
|
||||
if (!m_layoutRef.isUninitialized()) {
|
||||
m_layoutRef.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ bool LayoutField::handleEventWithText(const char * text, bool indentation, bool
|
||||
m_contentView.cursor()->addEmptyMatrixLayout();
|
||||
} else {
|
||||
Expression resultExpression = Expression::parse(text);
|
||||
if (!resultExpression.isDefined()) {
|
||||
if (resultExpression.isUninitialized()) {
|
||||
m_contentView.cursor()->insertText(text);
|
||||
} else {
|
||||
LayoutRef resultLayoutRef = resultExpression.createLayout(Poincare::Preferences::sharedPreferences()->displayMode(), Poincare::Preferences::sharedPreferences()->numberOfSignificantDigits());
|
||||
@@ -248,7 +248,7 @@ void LayoutField::scrollToBaselinedRect(KDRect rect, KDCoordinate baseline) {
|
||||
}
|
||||
|
||||
void LayoutField::insertLayoutAtCursor(LayoutRef layoutR, LayoutRef pointedLayoutR, bool forceCursorRightOfLayout) {
|
||||
if (!layoutR.isDefined() || layoutRef().isAllocationFailure()) {
|
||||
if (layoutR.isUninitialized() || layoutRef().isAllocationFailure()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ void LayoutField::insertLayoutAtCursor(LayoutRef layoutR, LayoutRef pointedLayou
|
||||
if (layoutRef().isAllocationFailure()) {
|
||||
m_contentView.cursor()->setLayoutReference(layoutRef());
|
||||
} else if(!forceCursorRightOfLayout) {
|
||||
if (pointedLayoutR.isDefined() && (!layoutWillBeMerged || pointedLayoutR != layoutR)) {
|
||||
if (!pointedLayoutR.isUninitialized() && (!layoutWillBeMerged || pointedLayoutR != layoutR)) {
|
||||
// Make sure the layout was inserted (its parent is not uninitialized)
|
||||
m_contentView.cursor()->setLayoutReference(pointedLayoutR);
|
||||
m_contentView.cursor()->setPosition(LayoutCursor::Position::Right);
|
||||
@@ -292,7 +292,7 @@ void LayoutField::insertLayoutAtCursor(LayoutRef layoutR, LayoutRef pointedLayou
|
||||
if (!layoutWillBeMerged) {
|
||||
scrollRightOfLayout(layoutR);
|
||||
} else {
|
||||
assert(lastMergedLayoutChild.isDefined());
|
||||
assert(!lastMergedLayoutChild.isUninitialized());
|
||||
scrollRightOfLayout(lastMergedLayoutChild);
|
||||
}
|
||||
scrollToCursor();
|
||||
|
||||
@@ -129,7 +129,7 @@ bool SelectableTableView::handleEvent(Ion::Events::Event event) {
|
||||
return true;
|
||||
}
|
||||
Poincare::LayoutRef layoutR = cell->layoutRef();
|
||||
if (layoutR.isDefined() && !layoutR.isAllocationFailure()) {
|
||||
if (!layoutR.isUninitialized() && !layoutR.isAllocationFailure()) {
|
||||
Clipboard::sharedClipboard()->store(layoutR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,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 isDefined() ? node()->createLayout(floatDisplayMode, numberOfSignificantDigits) : LayoutRef(); }
|
||||
LayoutRef createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { return node()->createLayout(floatDisplayMode, numberOfSignificantDigits); }
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode = Preferences::PrintFloatMode::Decimal, int numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits) const { return this->node()->serialize(buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits); }
|
||||
|
||||
/* Simplification */
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
}
|
||||
|
||||
// Definition
|
||||
bool isDefined() const { return m_layoutRef.isDefined(); }
|
||||
bool isDefined() const { return !m_layoutRef.isUninitialized(); }
|
||||
|
||||
// Getters and setters
|
||||
LayoutRef layoutReference() { return m_layoutRef; }
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
void replaceChildWithEmpty(LayoutReference oldChild, LayoutCursor * cursor = nullptr);
|
||||
void replaceWith(LayoutReference newChild, LayoutCursor * cursor) {
|
||||
LayoutReference p = parent();
|
||||
assert(p.isDefined());
|
||||
assert(!p.isUninitialized());
|
||||
p.replaceChild(*this, newChild, cursor);
|
||||
}
|
||||
void replaceWithJuxtapositionOf(LayoutReference leftChild, LayoutReference rightChild, LayoutCursor * cursor, bool putCursorInTheMiddle = false);
|
||||
|
||||
@@ -38,53 +38,54 @@ public:
|
||||
int identifier() const { return m_identifier; }
|
||||
virtual TreeNode * node() const { return TreePool::sharedPool()->node(m_identifier); }
|
||||
|
||||
bool isDefined() const { return m_identifier != TreePool::NoNodeIdentifier && node() != nullptr; }
|
||||
bool isAllocationFailure() const { return isDefined() && node()->isAllocationFailure(); }
|
||||
bool isUninitialized() const { return node()->isUninitialized(); }
|
||||
bool isAllocationFailure() const { return node()->isAllocationFailure(); }
|
||||
bool isStatic() const { return node()->isStatic(); }
|
||||
|
||||
int nodeRetainCount() const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return node()->retainCount();
|
||||
}
|
||||
void incrementNumberOfChildren(int increment = 1) {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
node()->incrementNumberOfChildren(increment);
|
||||
}
|
||||
void decrementNumberOfChildren(int decrement = 1) {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
node()->decrementNumberOfChildren(decrement);
|
||||
}
|
||||
int numberOfDescendants(bool includeSelf) const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return node()->numberOfDescendants(includeSelf);
|
||||
}
|
||||
|
||||
/* Hierarchy */
|
||||
bool hasChild(TreeByReference t) const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return node()->hasChild(t.node());
|
||||
}
|
||||
bool hasSibling(TreeByReference t) const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return node()->hasSibling(t.node());
|
||||
}
|
||||
bool hasAncestor(TreeByReference t, bool includeSelf) const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return node()->hasAncestor(t.node(), includeSelf);
|
||||
}
|
||||
int numberOfChildren() const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return node()->numberOfChildren();
|
||||
}
|
||||
TreeByReference parent() const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return TreeByReference(node()->parent());
|
||||
}
|
||||
TreeByReference childAtIndex(int i) const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return TreeByReference(node()->childAtIndex(i));
|
||||
}
|
||||
int indexOfChild(TreeByReference t) const {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
return node()->indexOfChild(t.node());
|
||||
}
|
||||
|
||||
@@ -118,9 +119,7 @@ protected:
|
||||
TreeByReference() : m_identifier(-1) {}
|
||||
void setIdentifierAndRetain(int newId) {
|
||||
m_identifier = newId;
|
||||
if (isDefined()) {
|
||||
node()->retain();
|
||||
}
|
||||
node()->retain();
|
||||
}
|
||||
void setTo(const TreeByReference & tr);
|
||||
/* Hierarchy operations */
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
virtual ~TreeByValue() = default;
|
||||
|
||||
bool isDefined() const { return TreeByReference::isDefined(); }
|
||||
bool isUninitialized() const { return TreeByReference::isUninitialized(); }
|
||||
bool isAllocationFailure() const { return TreeByReference::isAllocationFailure(); }
|
||||
|
||||
TreeNode * node() const override { return TreeByReference::node(); }
|
||||
|
||||
@@ -75,7 +75,7 @@ Expression AdditionNode::factorizeOnCommonDenominator(Context & context, Prefere
|
||||
Multiplication commonDenominator = Multiplication();
|
||||
for (int i = 0; i < numberOfChildren(); i++) {
|
||||
Expression denominator = childAtIndex(i)->denominator(context, angleUnit);
|
||||
if (denominator.isDefined()) {
|
||||
if (!denominator.isUninitialized()) {
|
||||
// Make commonDenominator = LeastCommonMultiple(commonDenominator, denominator);
|
||||
commonDenominator.addMissingFactors(denominator, context, angleUnit);
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ Expression ComplexNode<T>::complexToExpression(Preferences::ComplexFormat comple
|
||||
imag = Multiplication(Number::DecimalNumber(-this->imag()), Symbol(Ion::Charset::IComplex));
|
||||
}
|
||||
}
|
||||
if (!imag.isDefined()) {
|
||||
if (imag.isUninitialized()) {
|
||||
return real;
|
||||
} else if (!real.isDefined()) {
|
||||
} else if (real.isUninitialized()) {
|
||||
if (this->imag() > 0) {
|
||||
return imag;
|
||||
} else {
|
||||
@@ -110,9 +110,9 @@ Expression ComplexNode<T>::complexToExpression(Preferences::ComplexFormat comple
|
||||
}
|
||||
exp = Power(Symbol(Ion::Charset::Exponential), arg);
|
||||
}
|
||||
if (!exp.isDefined()) {
|
||||
if (exp.isUninitialized()) {
|
||||
return norm;
|
||||
} else if (!norm.isDefined()) {
|
||||
} else if (norm.isUninitialized()) {
|
||||
return exp;
|
||||
} else {
|
||||
return Multiplication(norm, exp);
|
||||
|
||||
@@ -201,11 +201,13 @@ bool Expression::isEqualToItsApproximationLayout(Expression approximation, int b
|
||||
|
||||
Expression Expression::ParseAndSimplify(const char * text, Context & context, Preferences::AngleUnit angleUnit) {
|
||||
Expression exp = parse(text);
|
||||
if (!exp.isDefined()) {
|
||||
if (exp.isUninitialized()) {
|
||||
return Undefined();
|
||||
}
|
||||
Expression reduced = exp.simplify(context, angleUnit);
|
||||
if (!reduced.isDefined()) {
|
||||
/* simplify might have been interrupted, in which case the resulting
|
||||
* expression is uninitialized, so we need to check that. */
|
||||
if (reduced.isUninitialized()) {
|
||||
return exp;
|
||||
}
|
||||
return reduced;
|
||||
@@ -250,11 +252,8 @@ Expression Expression::deepBeautify(Context & context, Preferences::AngleUnit an
|
||||
|
||||
template<typename U>
|
||||
Expression Expression::approximate(Context& context, Preferences::AngleUnit angleUnit, Preferences::Preferences::ComplexFormat complexFormat) const {
|
||||
if (isDefined()) {
|
||||
Evaluation<U> e = node()->approximate(U(), context, angleUnit);
|
||||
return e.complexToExpression(complexFormat);
|
||||
}
|
||||
return Undefined();
|
||||
Evaluation<U> e = node()->approximate(U(), context, angleUnit);
|
||||
return e.complexToExpression(complexFormat);
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
@@ -487,17 +486,17 @@ double Expression::nextIntersectionWithExpression(char symbol, double start, dou
|
||||
double extremumMax = std::isnan(result) ? max : result;
|
||||
Coordinate2D resultExtremum[2] = {
|
||||
nextMinimumOfExpression(symbol, start, step, extremumMax, [](char symbol, double x, Context & context, Preferences::AngleUnit angleUnit, const Expression expression0, const Expression expression1) {
|
||||
if (expression1.isDefined()) {
|
||||
return expression0.approximateWithValueForSymbol(symbol, x, context, angleUnit)-expression1.approximateWithValueForSymbol(symbol, x, context, angleUnit);
|
||||
} else {
|
||||
if (expression1.isUninitialized()) {
|
||||
return expression0.approximateWithValueForSymbol(symbol, x, context, angleUnit);
|
||||
} else {
|
||||
return expression0.approximateWithValueForSymbol(symbol, x, context, angleUnit)-expression1.approximateWithValueForSymbol(symbol, x, context, angleUnit);
|
||||
}
|
||||
}, context, angleUnit, expression, true),
|
||||
nextMinimumOfExpression(symbol, start, step, extremumMax, [](char symbol, double x, Context & context, Preferences::AngleUnit angleUnit, const Expression expression0, const Expression expression1) {
|
||||
if (expression1.isDefined()) {
|
||||
return expression1.approximateWithValueForSymbol(symbol, x, context, angleUnit)-expression0.approximateWithValueForSymbol(symbol, x, context, angleUnit);
|
||||
} else {
|
||||
if (expression1.isUninitialized()) {
|
||||
return -expression0.approximateWithValueForSymbol(symbol, x, context, angleUnit);
|
||||
} else {
|
||||
return expression1.approximateWithValueForSymbol(symbol, x, context, angleUnit)-expression0.approximateWithValueForSymbol(symbol, x, context, angleUnit);
|
||||
}
|
||||
}, context, angleUnit, expression, true)};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
||||
@@ -43,7 +43,7 @@ const Expression GlobalContext::expressionForSymbol(const Symbol symbol) {
|
||||
if (index < 0 || index >= k_maxNumberOfScalarExpressions) {
|
||||
return Expression();
|
||||
}
|
||||
if (m_expressions[index].isDefined()) {
|
||||
if (!m_expressions[index].isUninitialized()) {
|
||||
return m_expressions[index];
|
||||
}
|
||||
return defaultExpression();
|
||||
@@ -52,7 +52,7 @@ const Expression GlobalContext::expressionForSymbol(const Symbol symbol) {
|
||||
LayoutRef GlobalContext::layoutForSymbol(const Symbol symbol, int numberOfSignificantDigits) {
|
||||
if (Symbol::isMatrixSymbol(symbol.name())) {
|
||||
int index = symbolIndex(symbol);
|
||||
if (!m_matrixLayouts[index].isDefined()) {
|
||||
if (m_matrixLayouts[index].isUninitialized()) {
|
||||
m_matrixLayouts[index] = m_matrixExpressions[index].createLayout(Preferences::PrintFloatMode::Decimal, numberOfSignificantDigits);
|
||||
}
|
||||
return m_matrixLayouts[index];
|
||||
@@ -65,8 +65,8 @@ void GlobalContext::setExpressionForSymbolName(const Expression expression, cons
|
||||
if (Symbol::isMatrixSymbol(symbol.name())) {
|
||||
int indexMatrix = symbol.name() - (char)Symbol::SpecialSymbols::M0;
|
||||
assert(indexMatrix >= 0 && indexMatrix < k_maxNumberOfMatrixExpressions);
|
||||
Expression evaluation = expression.isDefined() ? expression.approximate<double>(context, Preferences::sharedPreferences()->angleUnit(), Preferences::sharedPreferences()->complexFormat()) : Expression(); // evaluate before deleting anything (to be able to evaluate M1+2->M1)
|
||||
if (evaluation.isDefined()) {
|
||||
Expression evaluation = expression.isUninitialized() ? Expression() : expression.approximate<double>(context, Preferences::sharedPreferences()->angleUnit(), Preferences::sharedPreferences()->complexFormat()); // evaluate before deleting anything (to be able to evaluate M1+2->M1)
|
||||
if (!evaluation.isUninitialized()) {
|
||||
if (evaluation.type() != ExpressionNode::Type::Matrix) {
|
||||
m_matrixExpressions[indexMatrix] = Matrix(evaluation);
|
||||
} else {
|
||||
@@ -78,8 +78,8 @@ void GlobalContext::setExpressionForSymbolName(const Expression expression, cons
|
||||
if (index < 0 || index >= k_maxNumberOfScalarExpressions) {
|
||||
return;
|
||||
}
|
||||
Expression evaluation = expression.isDefined() ? expression.approximate<double>(context, Preferences::sharedPreferences()->angleUnit(), Preferences::sharedPreferences()->complexFormat()) : Expression(); // evaluate before deleting anything (to be able to evaluate A+2->A)
|
||||
if (!evaluation.isDefined()) {
|
||||
Expression evaluation = expression.isUninitialized() ? Expression() : expression.approximate<double>(context, Preferences::sharedPreferences()->angleUnit(), Preferences::sharedPreferences()->complexFormat()); // evaluate before deleting anything (to be able to evaluate A+2->A)
|
||||
if (evaluation.isUninitialized()) {
|
||||
return;
|
||||
}
|
||||
if (evaluation.type() == ExpressionNode::Type::Matrix) {
|
||||
|
||||
@@ -173,7 +173,7 @@ void LayoutCursor::insertText(const char * text) {
|
||||
newChild = CharLayoutRef(Ion::Charset::MiddleDot);
|
||||
} else if (text[i] == '(') {
|
||||
newChild = CharLayoutRef('('); //TODO
|
||||
if (!pointedChild.isDefined()) {
|
||||
if (pointedChild.isUninitialized()) {
|
||||
pointedChild = newChild;
|
||||
}
|
||||
} else if (text[i] == ')') {
|
||||
@@ -205,7 +205,7 @@ void LayoutCursor::insertText(const char * text) {
|
||||
}
|
||||
m_layoutRef.addSibling(this, newChild, true);
|
||||
}
|
||||
if (pointedChild.isDefined() && pointedChild.parent().isDefined()) {
|
||||
if (!pointedChild.isUninitialized() && !pointedChild.parent().isUninitialized()) {
|
||||
m_layoutRef = pointedChild;
|
||||
}
|
||||
}
|
||||
@@ -276,7 +276,7 @@ bool LayoutCursor::baseForNewPowerLayout() {
|
||||
return true;
|
||||
}
|
||||
LayoutCursor equivalentLayoutCursor = m_layoutRef.equivalentCursor(this);
|
||||
if (!equivalentLayoutCursor.layoutReference().isDefined()
|
||||
if (equivalentLayoutCursor.layoutReference().isUninitialized()
|
||||
|| (equivalentLayoutCursor.layoutReference().isHorizontal()
|
||||
&& equivalentLayoutCursor.position() == Position::Left))
|
||||
{
|
||||
@@ -300,12 +300,12 @@ bool LayoutCursor::privateShowHideEmptyLayoutIfNeeded(bool show) {
|
||||
} else {
|
||||
// Check the equivalent cursor position
|
||||
LayoutRef equivalentPointedLayout = m_layoutRef.equivalentCursor(this).layoutReference();
|
||||
if (equivalentPointedLayout.isDefined() && equivalentPointedLayout.isEmpty()) {
|
||||
if (!equivalentPointedLayout.isUninitialized() && equivalentPointedLayout.isEmpty()) {
|
||||
adjacentEmptyLayout = equivalentPointedLayout;
|
||||
}
|
||||
}
|
||||
|
||||
if (!adjacentEmptyLayout.isDefined()) {
|
||||
if (adjacentEmptyLayout.isUninitialized()) {
|
||||
return false;
|
||||
}
|
||||
/* Change the visibility of the neighbouring empty layout: it might be either
|
||||
|
||||
@@ -46,7 +46,7 @@ LayoutRef LayoutHelper::Prefix(const Expression expression, Preferences::PrintFl
|
||||
LayoutRef LayoutHelper::Parentheses(LayoutRef layoutRef, bool cloneLayout) {
|
||||
HorizontalLayoutRef result;
|
||||
result.addChildAtIndex(LeftParenthesisLayoutRef(), 0, 0, nullptr);
|
||||
if (layoutRef.isDefined()) {
|
||||
if (!layoutRef.isUninitialized()) {
|
||||
result.addOrMergeChildAtIndex(cloneLayout ? layoutRef.clone() : layoutRef, 1, true);
|
||||
}
|
||||
result.addChildAtIndex(RightParenthesisLayoutRef(), result.numberOfChildren(), result.numberOfChildren(), nullptr);
|
||||
|
||||
@@ -237,7 +237,7 @@ void LayoutNode::scoreCursorInDescendantsVertically (
|
||||
bool LayoutNode::changeGreySquaresOfAllMatrixAncestors(bool add) {
|
||||
bool changedSquares = false;
|
||||
LayoutRef currentAncestor = LayoutRef(parent());
|
||||
while (currentAncestor.isDefined()) {
|
||||
while (!currentAncestor.isUninitialized()) {
|
||||
if (currentAncestor.isMatrix()) {
|
||||
if (add) {
|
||||
MatrixLayoutRef(static_cast<MatrixLayoutNode *>(currentAncestor.node())).addGreySquares();
|
||||
|
||||
@@ -50,7 +50,7 @@ void LayoutReference::replaceWithJuxtapositionOf(LayoutRef leftChild, LayoutRef
|
||||
return;
|
||||
}
|
||||
LayoutReference p = parent();
|
||||
assert(p.isDefined());
|
||||
assert(!p.isUninitialized());
|
||||
if (!p.isHorizontal()) {
|
||||
/* One of the children to juxtapose might be "this", so we cannot just call
|
||||
* replaceWith. */
|
||||
@@ -130,7 +130,7 @@ void LayoutReference::addSibling(LayoutCursor * cursor, LayoutReference sibling,
|
||||
* root layout. */
|
||||
LayoutRef rootLayout = root();
|
||||
LayoutRef p = parent();
|
||||
assert(p.isDefined());
|
||||
assert(!p.isUninitialized());
|
||||
if (p.isHorizontal()) {
|
||||
int indexInParent = p.indexOfChild(*this);
|
||||
int siblingIndex = cursor->position() == LayoutCursor::Position::Left ? indexInParent : indexInParent + 1;
|
||||
@@ -145,7 +145,7 @@ void LayoutReference::addSibling(LayoutCursor * cursor, LayoutReference sibling,
|
||||
} else if (cursor->position() == LayoutCursor::Position::Right && indexInParent < p.numberOfChildren() - 1) {
|
||||
neighbour = p.childAtIndex(indexInParent + 1);
|
||||
}
|
||||
if (neighbour.isDefined() && neighbour.isVerticalOffset()) {
|
||||
if (!neighbour.isUninitialized() && neighbour.isVerticalOffset()) {
|
||||
if (moveCursor) {
|
||||
cursor->setLayoutReference(neighbour);
|
||||
cursor->setPosition(cursor->position() == LayoutCursor::Position::Left ? LayoutCursor::Position::Right : LayoutCursor::Position::Left);
|
||||
@@ -198,7 +198,7 @@ void LayoutReference::removeChild(LayoutRef l, LayoutCursor * cursor, bool force
|
||||
|
||||
void LayoutReference::collapseOnDirection(HorizontalDirection direction, int absorbingChildIndex) {
|
||||
LayoutRef p = parent();
|
||||
if (!p.isDefined() || !p.isHorizontal()) {
|
||||
if (p.isUninitialized() || !p.isHorizontal()) {
|
||||
return;
|
||||
}
|
||||
int idxInParent = p.indexOfChild(*this);
|
||||
@@ -206,7 +206,7 @@ void LayoutReference::collapseOnDirection(HorizontalDirection direction, int abs
|
||||
int numberOfOpenParenthesis = 0;
|
||||
bool canCollapse = true;
|
||||
LayoutRef absorbingChild = childAtIndex(absorbingChildIndex);
|
||||
if (!absorbingChild.isDefined() || !absorbingChild.isHorizontal()) {
|
||||
if (absorbingChild.isUninitialized() || !absorbingChild.isHorizontal()) {
|
||||
return;
|
||||
}
|
||||
HorizontalLayoutRef horizontalAbsorbingChild = HorizontalLayoutRef(static_cast<HorizontalLayoutNode *>(absorbingChild.node()));
|
||||
|
||||
@@ -183,7 +183,7 @@ Matrix Matrix::rowCanonize(Context & context, Preferences::AngleUnit angleUnit,
|
||||
// No non-null coefficient in this column, skip
|
||||
k++;
|
||||
// Update determinant: det *= 0
|
||||
if (determinant.isDefined()) { determinant.addChildAtIndexInPlace(Rational(0), 0, determinant.numberOfChildren()); }
|
||||
if (!determinant.isUninitialized()) { determinant.addChildAtIndexInPlace(Rational(0), 0, determinant.numberOfChildren()); }
|
||||
} else {
|
||||
// Swap row h and iPivot
|
||||
if (iPivot != h) {
|
||||
@@ -191,12 +191,12 @@ Matrix Matrix::rowCanonize(Context & context, Preferences::AngleUnit angleUnit,
|
||||
matrix.swapChildrenInPlace(iPivot*n+col, h*n+col);
|
||||
}
|
||||
// Update determinant: det *= -1
|
||||
if (determinant.isDefined()) { determinant.addChildAtIndexInPlace(Rational(-1), 0, determinant.numberOfChildren()); }
|
||||
if (!determinant.isUninitialized()) { determinant.addChildAtIndexInPlace(Rational(-1), 0, determinant.numberOfChildren()); }
|
||||
}
|
||||
/* Set to 1 M[h][k] by linear combination */
|
||||
Expression divisor = matrixChild(h, k);
|
||||
// Update determinant: det *= divisor
|
||||
if (determinant.isDefined()) { determinant.addChildAtIndexInPlace(divisor, 0, determinant.numberOfChildren()); }
|
||||
if (!determinant.isUninitialized()) { determinant.addChildAtIndexInPlace(divisor, 0, determinant.numberOfChildren()); }
|
||||
for (int j = k+1; j < n; j++) {
|
||||
Expression opHJ = matrixChild(h, j);
|
||||
Expression newOpHJ = Division(opHJ, divisor);
|
||||
|
||||
@@ -517,7 +517,7 @@ template<typename T> MatrixComplex<T> PowerNode::computeOnMatrixAndComplex(const
|
||||
}
|
||||
if (power < 0) {
|
||||
MatrixComplex<T> inverse = m.inverse();
|
||||
if (!inverse.isDefined()) {
|
||||
if (inverse.isUninitialized()) {
|
||||
return MatrixComplex<T>::Undefined();
|
||||
}
|
||||
Complex<T> minusC = Complex<T>(-d);
|
||||
|
||||
@@ -156,10 +156,10 @@ Evaluation<T> SymbolNode::templatedApproximate(Context& context, Preferences::An
|
||||
return Complex<T>(0.0, 1.0);
|
||||
}
|
||||
const Expression e = context.expressionForSymbol(Symbol(m_name));
|
||||
if (e.isDefined()) {
|
||||
return e.node()->approximate(T(), context, angleUnit);
|
||||
if (e.isUninitialized()) {
|
||||
return Complex<T>::Undefined();
|
||||
}
|
||||
return Complex<T>::Undefined();
|
||||
return e.node()->approximate(T(), context, angleUnit);
|
||||
}
|
||||
|
||||
const char * Symbol::textForSpecialSymbols(char name) {
|
||||
@@ -302,12 +302,12 @@ Expression Symbol::shallowReduce(Context& context, Preferences::AngleUnit angleU
|
||||
#if 0
|
||||
// Do not replace symbols in expression of type: 3->A
|
||||
Expression p = parent();
|
||||
if (p.isDefined() && p.type() == ExpressionNode::Type::Store && p.childAtIndex(1) == *this) {
|
||||
if (!p.isUninitialized() && p.type() == ExpressionNode::Type::Store && p.childAtIndex(1) == *this) {
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
const Expression e = context.expressionForSymbol(*this);
|
||||
if (e.isDefined() && node()->hasAnExactRepresentation(context)) {
|
||||
if (!e.isUninitialized() && node()->hasAnExactRepresentation(context)) {
|
||||
// TODO: later AZ should be replaced.
|
||||
/* The stored expression had been beautified which forces to call deepReduce. */
|
||||
return e.deepReduce(context, angleUnit);
|
||||
@@ -319,7 +319,7 @@ Expression Symbol::replaceSymbolWithExpression(char symbol, Expression expressio
|
||||
if (name() == symbol) {
|
||||
Expression value = expression;
|
||||
Expression p = parent();
|
||||
if (p.isDefined() && value.node()->needsParenthesesWithParent(p.node())) {
|
||||
if (!p.isUninitialized() && value.node()->needsParenthesesWithParent(p.node())) {
|
||||
value = Parenthesis(value);
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -9,16 +9,14 @@ namespace Poincare {
|
||||
/* Constructors */
|
||||
|
||||
TreeByReference::~TreeByReference() {
|
||||
if (isDefined()) {
|
||||
assert(node()->identifier() == m_identifier);
|
||||
node()->release(numberOfChildren()); //TODO No malformed nodes ?
|
||||
}
|
||||
assert(node()->identifier() == m_identifier);
|
||||
node()->release(numberOfChildren()); //TODO No malformed nodes ?
|
||||
}
|
||||
|
||||
/* Clone */
|
||||
|
||||
TreeByReference TreeByReference::clone() const {
|
||||
if (!isDefined()){
|
||||
if (isUninitialized()){
|
||||
return TreeByReference();
|
||||
}
|
||||
TreeNode * myNode = node();
|
||||
@@ -33,12 +31,12 @@ TreeByReference TreeByReference::clone() const {
|
||||
/* Hierarchy operations */
|
||||
|
||||
void TreeByReference::replaceWithInPlace(TreeByReference t) {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
if (isAllocationFailure()) {
|
||||
return;
|
||||
}
|
||||
TreeByReference p = parent();
|
||||
if (p.isDefined()) {
|
||||
if (!p.isUninitialized()) {
|
||||
p.replaceChildInPlace(*this, t);
|
||||
}
|
||||
}
|
||||
@@ -48,7 +46,7 @@ void TreeByReference::replaceChildInPlace(TreeByReference oldChild, TreeByRefere
|
||||
return;
|
||||
}
|
||||
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
if (isAllocationFailure()) {
|
||||
return;
|
||||
}
|
||||
@@ -58,7 +56,7 @@ void TreeByReference::replaceChildInPlace(TreeByReference oldChild, TreeByRefere
|
||||
}
|
||||
|
||||
// Move the new child
|
||||
assert(!newChild.parent().isDefined());
|
||||
assert(newChild.parent().isUninitialized());
|
||||
TreePool::sharedPool()->move(oldChild.node(), newChild.node(), newChild.numberOfChildren());
|
||||
/* We could have moved the new node to oldChild.node()->nextSibling(), but
|
||||
* nextSibling is not computed correctly if we inserted an
|
||||
@@ -74,9 +72,9 @@ void TreeByReference::replaceWithAllocationFailureInPlace(int currentNumberOfChi
|
||||
if (isAllocationFailure()) {
|
||||
return;
|
||||
}
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
TreeByReference p = parent();
|
||||
bool hasParent = p.isDefined();
|
||||
bool hasParent = !p.isUninitialized();
|
||||
int indexInParentNode = hasParent ? node()->indexInParent() : -1;
|
||||
int currentRetainCount = node()->retainCount();
|
||||
TreeNode * staticAllocFailNode = node()->failedAllocationStaticNode();
|
||||
@@ -100,7 +98,7 @@ void TreeByReference::replaceWithAllocationFailureInPlace(int currentNumberOfChi
|
||||
TreeNode * newAllocationFailureNode = TreePool::sharedPool()->deepCopy(staticAllocFailNode);
|
||||
newAllocationFailureNode->rename(m_identifier, true);
|
||||
newAllocationFailureNode->retain();
|
||||
if (p.isDefined()) {
|
||||
if (hasParent) {
|
||||
assert(indexInParentNode >= 0);
|
||||
/* Set the refCount to previousRefCount-1 because the previous parent is
|
||||
* no longer retaining the node. When we add this node to the parent, it
|
||||
@@ -138,7 +136,7 @@ void TreeByReference::mergeChildrenAtIndexInPlace(TreeByReference t, int i) {
|
||||
}
|
||||
|
||||
void TreeByReference::swapChildrenInPlace(int i, int j) {
|
||||
assert(isDefined());
|
||||
assert(!isStatic());
|
||||
assert(i >= 0 && i < numberOfChildren());
|
||||
assert(j >= 0 && j < numberOfChildren());
|
||||
if (i == j) {
|
||||
@@ -163,7 +161,7 @@ void TreeByReference::log() const {
|
||||
|
||||
// Add
|
||||
void TreeByReference::addChildAtIndexInPlace(TreeByReference t, int index, int currentNumberOfChildren) {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
if (node()->isAllocationFailure()) {
|
||||
return;
|
||||
}
|
||||
@@ -173,7 +171,7 @@ void TreeByReference::addChildAtIndexInPlace(TreeByReference t, int index, int c
|
||||
}
|
||||
assert(index >= 0 && index <= currentNumberOfChildren);
|
||||
|
||||
assert(!t.parent().isDefined());
|
||||
assert(t.parent().isUninitialized());
|
||||
// Move t
|
||||
TreeNode * newChildPosition = node()->next();
|
||||
for (int i = 0; i < index; i++) {
|
||||
@@ -189,21 +187,21 @@ void TreeByReference::addChildAtIndexInPlace(TreeByReference t, int index, int c
|
||||
// Remove
|
||||
|
||||
void TreeByReference::removeChildAtIndexInPlace(int i) {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
assert(i >= 0 && i < numberOfChildren());
|
||||
TreeByReference t = childAtIndex(i);
|
||||
removeChildInPlace(t, t.numberOfChildren());
|
||||
}
|
||||
|
||||
void TreeByReference::removeChildInPlace(TreeByReference t, int childNumberOfChildren) {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
TreePool::sharedPool()->move(TreePool::sharedPool()->last(), t.node(), childNumberOfChildren);
|
||||
t.node()->release(childNumberOfChildren);
|
||||
node()->decrementNumberOfChildren();
|
||||
}
|
||||
|
||||
void TreeByReference::removeChildrenInPlace(int currentNumberOfChildren) {
|
||||
assert(isDefined());
|
||||
assert(!isUninitialized());
|
||||
for (int i = 0; i < currentNumberOfChildren; i++) {
|
||||
TreeByReference childRef = childAtIndex(0);
|
||||
TreePool::sharedPool()->move(TreePool::sharedPool()->last(), childRef.node(), childRef.numberOfChildren());
|
||||
|
||||
@@ -22,7 +22,7 @@ void VariableContext<T>::setApproximationForVariable(T value) {
|
||||
template<typename T>
|
||||
void VariableContext<T>::setExpressionForSymbolName(const Expression expression, const Symbol symbol, Context & context) {
|
||||
if (symbol.name() == m_name) {
|
||||
if (!expression.isDefined()) {
|
||||
if (expression.isUninitialized()) {
|
||||
return;
|
||||
}
|
||||
m_value = Float<T>(expression.approximateToScalar<T>(context, Preferences::sharedPreferences()->angleUnit()));
|
||||
|
||||
@@ -271,7 +271,7 @@ bool VerticalOffsetLayoutNode::willAddSibling(LayoutCursor * cursor, LayoutNode
|
||||
assert(cursor->position() == LayoutCursor::Position::Left);
|
||||
parentRef.addChildAtIndex(rightParenthesis, idxInParent, parentRef.numberOfChildren(), nullptr);
|
||||
}
|
||||
if (rightParenthesis.parent().isDefined()) {
|
||||
if (!rightParenthesis.parent().isUninitialized()) {
|
||||
cursor->setLayoutReference(rightParenthesis);
|
||||
}
|
||||
if (rootLayout.isAllocationFailure()) {
|
||||
|
||||
@@ -49,7 +49,7 @@ Expression parse_expression(const char * expression) {
|
||||
strlcpy(buffer, expression, sizeof(buffer));
|
||||
translate_in_special_chars(buffer);
|
||||
Expression result = Expression::parse(buffer);
|
||||
assert(result.isDefined());
|
||||
assert(!result.isUninitialized());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user