StaticAllocationFailureNodes are not stored in the pool

This commit is contained in:
Léa Saviot
2018-06-29 15:30:40 +02:00
parent 8117e73561
commit a4471e1570
13 changed files with 68 additions and 32 deletions

View File

@@ -2,12 +2,11 @@
#include "allocation_failed_expression_node.h"
template<>
TreeNode * ExpressionRef::staticFailedAllocationStaticNode() {
static AllocationFailedExpressionRef FailureRef;
return FailureRef.node();
}
template<>
ExpressionReference<ExpressionNode> ExpressionRef::staticFailedAllocationStaticRef() {
return ExpressionReference<ExpressionNode>(staticFailedAllocationStaticNode());
TreeNode * ExpressionRef::FailedAllocationStaticNode() {
static AllocationFailedExpressionNode FailureNode;
if (FailureNode.identifier() >= -1) {
int newIdentifier = TreePool::sharedPool()->registerStaticNode(&FailureNode);
FailureNode.rename(newIdentifier);
}
return &FailureNode;
}