From 882e81e4dbbcf894b0367f7d0c2807149b25110a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 2 Jul 2018 13:12:04 +0200 Subject: [PATCH] Remove Nodes' init method: assert node is not allocationFailure instead --- char_layout_node.h | 4 +++- float_node.h | 5 +++-- tree_node.h | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/char_layout_node.h b/char_layout_node.h index 71efb07b1..44b8c1e62 100644 --- a/char_layout_node.h +++ b/char_layout_node.h @@ -50,7 +50,9 @@ private: class CharLayoutRef : public LayoutReference { public: CharLayoutRef(char c) : LayoutReference() { - this->castedNode()->setChar(c); //TODO use init + if (!(this->node()->isAllocationFailure())) { + this->castedNode()->setChar(c); + } } }; diff --git a/float_node.h b/float_node.h index 87f648ffc..da9cf2851 100644 --- a/float_node.h +++ b/float_node.h @@ -18,7 +18,6 @@ public: return m_value > 1 ? "BigFloat" : "SmallFloat"; } void setFloat(float f) { m_value = f; } - void init(float f) override { m_value = f; } private: float m_value; }; @@ -26,7 +25,9 @@ private: class FloatRef : public ExpressionReference { public: FloatRef(float f) : ExpressionReference() { - this->node()->init(f); + if (!(this->node()->isAllocationFailure())) { + this->castedNode()->setFloat(f); + } } }; diff --git a/tree_node.h b/tree_node.h index cdcf854fd..1cc3b26ba 100644 --- a/tree_node.h +++ b/tree_node.h @@ -37,7 +37,6 @@ public: } // Node operations - virtual void init(float f) {} void retain() { m_referenceCounter++; } void release(); void releaseChildren();