summaryrefslogtreecommitdiff
path: root/src/expr/expr_manager_template.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr/expr_manager_template.cpp')
-rw-r--r--src/expr/expr_manager_template.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/expr/expr_manager_template.cpp b/src/expr/expr_manager_template.cpp
index fa1a1a6af..6a2640080 100644
--- a/src/expr/expr_manager_template.cpp
+++ b/src/expr/expr_manager_template.cpp
@@ -57,16 +57,34 @@ KindType* ExprManager::kindType() const {
}
Expr ExprManager::mkExpr(Kind kind) {
+ const unsigned n = 0;
+ CheckArgument(n >= minArity(kind) && n <= maxArity(kind), kind,
+ "Exprs with kind %s must have at least %u children and "
+ "at most %u children (the one under construction has %u)",
+ kind::kindToString(kind).c_str(),
+ minArity(kind), maxArity(kind), n);
NodeManagerScope nms(d_nodeManager);
return Expr(this, new Node(d_nodeManager->mkNode(kind)));
}
Expr ExprManager::mkExpr(Kind kind, const Expr& child1) {
+ const unsigned n = 1;
+ CheckArgument(n >= minArity(kind) && n <= maxArity(kind), kind,
+ "Exprs with kind %s must have at least %u children and "
+ "at most %u children (the one under construction has %u)",
+ kind::kindToString(kind).c_str(),
+ minArity(kind), maxArity(kind), n);
NodeManagerScope nms(d_nodeManager);
return Expr(this, new Node(d_nodeManager->mkNode(kind, child1.getNode())));
}
Expr ExprManager::mkExpr(Kind kind, const Expr& child1, const Expr& child2) {
+ const unsigned n = 2;
+ CheckArgument(n >= minArity(kind) && n <= maxArity(kind), kind,
+ "Exprs with kind %s must have at least %u children and "
+ "at most %u children (the one under construction has %u)",
+ kind::kindToString(kind).c_str(),
+ minArity(kind), maxArity(kind), n);
NodeManagerScope nms(d_nodeManager);
return Expr(this, new Node(d_nodeManager->mkNode(kind, child1.getNode(),
child2.getNode())));
@@ -74,6 +92,12 @@ Expr ExprManager::mkExpr(Kind kind, const Expr& child1, const Expr& child2) {
Expr ExprManager::mkExpr(Kind kind, const Expr& child1, const Expr& child2,
const Expr& child3) {
+ const unsigned n = 3;
+ CheckArgument(n >= minArity(kind) && n <= maxArity(kind), kind,
+ "Exprs with kind %s must have at least %u children and "
+ "at most %u children (the one under construction has %u)",
+ kind::kindToString(kind).c_str(),
+ minArity(kind), maxArity(kind), n);
NodeManagerScope nms(d_nodeManager);
return Expr(this, new Node(d_nodeManager->mkNode(kind, child1.getNode(),
child2.getNode(), child3.getNode())));
@@ -81,6 +105,12 @@ Expr ExprManager::mkExpr(Kind kind, const Expr& child1, const Expr& child2,
Expr ExprManager::mkExpr(Kind kind, const Expr& child1, const Expr& child2,
const Expr& child3, const Expr& child4) {
+ const unsigned n = 4;
+ CheckArgument(n >= minArity(kind) && n <= maxArity(kind), kind,
+ "Exprs with kind %s must have at least %u children and "
+ "at most %u children (the one under construction has %u)",
+ kind::kindToString(kind).c_str(),
+ minArity(kind), maxArity(kind), n);
NodeManagerScope nms(d_nodeManager);
return Expr(this, new Node(d_nodeManager->mkNode(kind, child1.getNode(),
child2.getNode(), child3.getNode(),
@@ -90,6 +120,12 @@ Expr ExprManager::mkExpr(Kind kind, const Expr& child1, const Expr& child2,
Expr ExprManager::mkExpr(Kind kind, const Expr& child1, const Expr& child2,
const Expr& child3, const Expr& child4,
const Expr& child5) {
+ const unsigned n = 5;
+ CheckArgument(n >= minArity(kind) && n <= maxArity(kind), kind,
+ "Exprs with kind %s must have at least %u children and "
+ "at most %u children (the one under construction has %u)",
+ kind::kindToString(kind).c_str(),
+ minArity(kind), maxArity(kind), n);
NodeManagerScope nms(d_nodeManager);
return Expr(this, new Node(d_nodeManager->mkNode(kind, child1.getNode(),
child2.getNode(), child3.getNode(),
@@ -97,6 +133,13 @@ Expr ExprManager::mkExpr(Kind kind, const Expr& child1, const Expr& child2,
}
Expr ExprManager::mkExpr(Kind kind, const vector<Expr>& children) {
+ const unsigned n = children.size();
+ CheckArgument(n >= minArity(kind) && n <= maxArity(kind), kind,
+ "Exprs with kind %s must have at least %u children and "
+ "at most %u children (the one under construction has %u)",
+ kind::kindToString(kind).c_str(),
+ minArity(kind), maxArity(kind), n);
+
NodeManagerScope nms(d_nodeManager);
vector<Node> nodes;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback