template <unsigned nchild_thresh>
Node NodeBuilder<nchild_thresh>::constructNode() {
- return Node(constructNV());
+ Node n = Node(constructNV());
+ if( IS_DEBUG_BUILD ) {
+ // force an immediate type check
+ d_nm->getType(n,true);
+ }
+ return n;
}
template <unsigned nchild_thresh>
Node NodeBuilder<nchild_thresh>::constructNode() const {
- return Node(constructNV());
+ Node n = Node(constructNV());
+ if( IS_DEBUG_BUILD ) {
+ // force an immediate type check
+ d_nm->getType(n,true);
+ }
+ return n;
}
template <unsigned nchild_thresh>
Node* NodeBuilder<nchild_thresh>::constructNodePtr() {
- return new Node(constructNV());
+ Node *np = new Node(constructNV());
+ if( IS_DEBUG_BUILD ) {
+ // force an immediate type check
+ d_nm->getType(*np,true);
+ }
+ return np;
}
template <unsigned nchild_thresh>
Node* NodeBuilder<nchild_thresh>::constructNodePtr() const {
- return new Node(constructNV());
+ Node *np = new Node(constructNV());
+ if( IS_DEBUG_BUILD ) {
+ // force an immediate type check
+ d_nm->getType(*np,true);
+ }
+ return np;
}
template <unsigned nchild_thresh>
// bool containsDecision(TNode); // is "atomic"
// bool properlyContainsDecision(TNode); // all children are atomic
- template <unsigned nchild_thresh>
- Node doMkNode(NodeBuilder<nchild_thresh>&);
-
- template <unsigned nchild_thresh>
- Node* doMkNodePtr(NodeBuilder<nchild_thresh>&);
-
public:
NodeManager(context::Context* ctxt);
return type;
}
-template <unsigned nchild_thresh>
-inline Node NodeManager::doMkNode(NodeBuilder<nchild_thresh>& nb) {
- Node n = nb.constructNode();
- if( IS_DEBUG_BUILD ) {
- // force an immediate type check
- getType(n,true);
- }
- return n;
-}
-
-template <unsigned nchild_thresh>
-inline Node* NodeManager::doMkNodePtr(NodeBuilder<nchild_thresh>& nb) {
- Node* np = nb.constructNodePtr();
- if( IS_DEBUG_BUILD ) {
- // force an immediate type check
- getType(*np,true);
- }
- return np;
-}
-
-
inline Node NodeManager::mkNode(Kind kind, TNode child1) {
NodeBuilder<1> nb(this, kind);
nb << child1;
- return doMkNode(nb);
+ return nb.constructNode();
}
inline Node* NodeManager::mkNodePtr(Kind kind, TNode child1) {
NodeBuilder<1> nb(this, kind);
nb << child1;
- return doMkNodePtr(nb);
+ return nb.constructNodePtr();
}
inline Node NodeManager::mkNode(Kind kind, TNode child1, TNode child2) {
NodeBuilder<2> nb(this, kind);
nb << child1 << child2;
- return doMkNode(nb);
+ return nb.constructNode();
}
inline Node* NodeManager::mkNodePtr(Kind kind, TNode child1, TNode child2) {
NodeBuilder<2> nb(this, kind);
nb << child1 << child2;
- return doMkNodePtr(nb);
+ return nb.constructNodePtr();
}
inline Node NodeManager::mkNode(Kind kind, TNode child1, TNode child2,
TNode child3) {
NodeBuilder<3> nb(this, kind);
nb << child1 << child2 << child3;
- return doMkNode(nb);
+ return nb.constructNode();
}
inline Node* NodeManager::mkNodePtr(Kind kind, TNode child1, TNode child2,
TNode child3) {
NodeBuilder<3> nb(this, kind);
nb << child1 << child2 << child3;
- return doMkNodePtr(nb);
+ return nb.constructNodePtr();
}
inline Node NodeManager::mkNode(Kind kind, TNode child1, TNode child2,
TNode child3, TNode child4) {
NodeBuilder<4> nb(this, kind);
nb << child1 << child2 << child3 << child4;
- return doMkNode(nb);
+ return nb.constructNode();
}
inline Node* NodeManager::mkNodePtr(Kind kind, TNode child1, TNode child2,
TNode child3, TNode child4) {
NodeBuilder<4> nb(this, kind);
nb << child1 << child2 << child3 << child4;
- return doMkNodePtr(nb);
+ return nb.constructNodePtr();
}
inline Node NodeManager::mkNode(Kind kind, TNode child1, TNode child2,
TNode child3, TNode child4, TNode child5) {
NodeBuilder<5> nb(this, kind);
nb << child1 << child2 << child3 << child4 << child5;
- return doMkNode(nb);
+ return nb.constructNode();
}
inline Node* NodeManager::mkNodePtr(Kind kind, TNode child1, TNode child2,
TNode child3, TNode child4, TNode child5) {
NodeBuilder<5> nb(this, kind);
nb << child1 << child2 << child3 << child4 << child5;
- return doMkNodePtr(nb);
+ return nb.constructNodePtr();
}
// N-ary version
children) {
NodeBuilder<> nb(this, kind);
nb.append(children);
- return doMkNode(nb);
+ return nb.constructNode();
}
template <bool ref_count>
children) {
NodeBuilder<> nb(this, kind);
nb.append(children);
- return doMkNodePtr(nb);
+ return nb.constructNodePtr();
}
// N-ary version for operators
NodeBuilder<> nb(this, kind::operatorKindToKind(opNode.getKind()));
nb << opNode;
nb.append(children);
- return doMkNode(nb);
+ return nb.constructNode();
}
template <bool ref_count>
NodeBuilder<> nb(this, kind::operatorKindToKind(opNode.getKind()));
nb << opNode;
nb.append(children);
- return doMkNodePtr(nb);
+ return nb.constructNodePtr();
}