[poincare] Temporary commit that handles nullptr nodes in References

This commit is contained in:
Léa Saviot
2018-08-13 12:22:46 +02:00
parent 6352bbcdd9
commit fe0fa95235
4 changed files with 6 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ template<typename T>
class Evaluation : public TreeByValue {
public:
EvaluationNode<T> * node() const override {
assert(!TreeByValue::node()->isGhost());
assert(TreeByValue::node() == nullptr || !TreeByValue::node()->isGhost());
return static_cast<EvaluationNode<T> *>(TreeByValue::node());
}
Evaluation() : Evaluation(nullptr) {}

View File

@@ -34,7 +34,7 @@ public:
/* Reference */
ExpressionNode * node() const override {
assert(!TreeByValue::node()->isGhost());
assert(TreeByValue::node() == nullptr || !TreeByValue::node()->isGhost());
return static_cast<ExpressionNode *>(TreeByValue::node());
}

View File

@@ -29,7 +29,7 @@ public:
}
LayoutNode * node() const override {
assert(!TreeByReference::node()->isGhost());
assert(TreeByReference::node() == nullptr || !TreeByReference::node()->isGhost());
return static_cast<LayoutNode *>(TreeByReference::node());
}

View File

@@ -117,7 +117,9 @@ protected:
TreeByReference() : m_identifier(-1) {}
void setIdentifierAndRetain(int newId) {
m_identifier = newId;
node()->retain();
if (isDefined()) {
node()->retain();
}
}
/* Hierarchy operations */
// Add