Expr ValidityChecker::recSelectExpr(const Expr& record, const std::string& field) {
Type t = record.getType();
const CVC4::Datatype& dt = ((CVC4::DatatypeType)t).getDatatype();
- const CVC4::Record& rec = t.getRecord();
+ const CVC4::Record& rec = ((CVC4::DatatypeType)t).getRecord();
unsigned index = rec.getIndex(field);
return d_em->mkExpr(CVC4::kind::APPLY_SELECTOR_TOTAL, dt[0][index].getSelector(), record);
}
}
Expr ValidityChecker::tupleSelectExpr(const Expr& tuple, int index) {
- CompatCheckArgument(index >= 0 && index < tuple.getType().getTupleLength(),
+ CompatCheckArgument(index >= 0 && index < ((CVC4::DatatypeType)tuple.getType()).getTupleLength(),
"invalid index in tuple select");
const CVC4::Datatype& dt = ((CVC4::DatatypeType)tuple.getType()).getDatatype();
return d_em->mkExpr(CVC4::kind::APPLY_SELECTOR_TOTAL, dt[0][index].getSelector(), tuple);
return d_typeNode->isRecord();
}
-/** Get the length of a tuple type */
-size_t Type::getTupleLength() const {
- NodeManagerScope nms(d_nodeManager);
- return d_typeNode->getTupleLength();
-}
-
-/** Get the constituent types of a tuple type */
-std::vector<Type> Type::getTupleTypes() const {
- NodeManagerScope nms(d_nodeManager);
- std::vector< TypeNode > vec = d_typeNode->getTupleTypes();
- std::vector< Type > vect;
- for( unsigned i=0; i<vec.size(); i++ ){
- vect.push_back( vec[i].toType() );
- }
- return vect;
-}
-
-/** Get the description of the record type */
-const Record& Type::getRecord() const {
- NodeManagerScope nms(d_nodeManager);
- return d_typeNode->getRecord();
-}
-
/** Is this a symbolic expression type? */
bool Type::isSExpr() const {
NodeManagerScope nms(d_nodeManager);
return DatatypeType(makeType(d_nodeManager->mkTypeNode(kind::PARAMETRIC_DATATYPE, paramsNodes)));
}
+/** Get the length of a tuple type */
+size_t DatatypeType::getTupleLength() const {
+ NodeManagerScope nms(d_nodeManager);
+ return d_typeNode->getTupleLength();
+}
+
+/** Get the constituent types of a tuple type */
+std::vector<Type> DatatypeType::getTupleTypes() const {
+ NodeManagerScope nms(d_nodeManager);
+ std::vector< TypeNode > vec = d_typeNode->getTupleTypes();
+ std::vector< Type > vect;
+ for( unsigned i=0; i<vec.size(); i++ ){
+ vect.push_back( vec[i].toType() );
+ }
+ return vect;
+}
+
+/** Get the description of the record type */
+const Record& DatatypeType::getRecord() const {
+ NodeManagerScope nms(d_nodeManager);
+ return d_typeNode->getRecord();
+}
+
DatatypeType SelectorType::getDomain() const {
return DatatypeType(makeType((*d_typeNode)[0]));
}
*/
bool isRecord() const;
- /** Get the length of a tuple type */
- size_t getTupleLength() const;
-
- /** Get the constituent types of a tuple type */
- std::vector<Type> getTupleTypes() const;
-
- /** Get the description of the record type */
- const Record& getRecord() const;
-
/**
* Is this a symbolic expression type?
* @return true if the type is a symbolic expression type
/** Instantiate a datatype using this datatype constructor */
DatatypeType instantiate(const std::vector<Type>& params) const;
+ /** Get the length of a tuple type */
+ size_t getTupleLength() const;
+
+ /** Get the constituent types of a tuple type */
+ std::vector<Type> getTupleTypes() const;
+
+ /** Get the description of the record type */
+ const Record& getRecord() const;
+
};/* class DatatypeType */
/**
: restrictedTypePossiblyFunctionLHS[t,check,lhs]
{ if(lhs) {
assert(t.isTuple());
- args = t.getTupleTypes();
+ args = ((DatatypeType)t).getTupleTypes();
} else {
args.push_back(t);
}
if(! t.isTuple()) {
PARSER_STATE->parseError("tuple-update applied to non-tuple");
}
- size_t length = t.getTupleLength();
+ size_t length = ((DatatypeType)t).getTupleLength();
if(k >= length) {
std::stringstream ss;
ss << "tuple is of length " << length << "; cannot update index " << k;
<< "its type: " << t;
PARSER_STATE->parseError(ss.str());
}
- const Record& rec = t.getRecord();
+ const Record& rec = ((DatatypeType)t).getRecord();
if(! rec.contains(id)) {
PARSER_STATE->parseError(std::string("no such field `") + id + "' in record");
}
if(! t.isRecord()) {
PARSER_STATE->parseError("record-select applied to non-record");
}
- const Record& rec = t.getRecord();
+ const Record& rec = ((DatatypeType)t).getRecord();
if(!rec.contains(id)){
PARSER_STATE->parseError(std::string("no such field `") + id + "' in record");
}
if(! t.isTuple()) {
PARSER_STATE->parseError("tuple-select applied to non-tuple");
}
- size_t length = t.getTupleLength();
+ size_t length = ((DatatypeType)t).getTupleLength();
if(k >= length) {
std::stringstream ss;
ss << "tuple is of length " << length << "; cannot access index " << k;