summaryrefslogtreecommitdiff
path: root/src/expr
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2021-09-14 16:40:01 -0500
committerGitHub <noreply@github.com>2021-09-14 16:40:01 -0500
commit32f8bf41dcc5a760948185ff7be7ce93eb7a06dd (patch)
tree179ceeceeeb9b3ca8dfe513f5f36f2ac6a2f5add /src/expr
parent86460c41713243e0018e3038bcba5d053156b8b6 (diff)
parent74c5067d81b8384701cff7f6e7b697d7fe67cf58 (diff)
Merge branch 'master' into fixParseOnlyfixParseOnly
Diffstat (limited to 'src/expr')
-rw-r--r--src/expr/dtype.cpp13
-rw-r--r--src/expr/dtype.h6
2 files changed, 19 insertions, 0 deletions
diff --git a/src/expr/dtype.cpp b/src/expr/dtype.cpp
index 31a22b44a..fdb397d39 100644
--- a/src/expr/dtype.cpp
+++ b/src/expr/dtype.cpp
@@ -895,6 +895,19 @@ const std::vector<std::shared_ptr<DTypeConstructor> >& DType::getConstructors()
return d_constructors;
}
+std::unordered_set<TypeNode> DType::getSubfieldTypes() const
+{
+ std::unordered_set<TypeNode> subFieldTypes;
+ for (std::shared_ptr<DTypeConstructor> ctor : d_constructors)
+ {
+ for (size_t i = 0, nargs = ctor->getNumArgs(); i < nargs; i++)
+ {
+ subFieldTypes.insert(ctor->getArgType(i));
+ }
+ }
+ return subFieldTypes;
+}
+
std::ostream& operator<<(std::ostream& os, const DType& dt)
{
// can only output datatypes in the cvc5 native language
diff --git a/src/expr/dtype.h b/src/expr/dtype.h
index a608b9adb..4f54f0af7 100644
--- a/src/expr/dtype.h
+++ b/src/expr/dtype.h
@@ -425,6 +425,12 @@ class DType
const std::vector<std::shared_ptr<DTypeConstructor> >& getConstructors()
const;
+ /**
+ * Return the subfield types of this datatype. This is the set of all types T
+ * for which there exists an argument to a constructor of type T.
+ */
+ std::unordered_set<TypeNode> getSubfieldTypes() const;
+
/** prints this datatype to stream */
void toStream(std::ostream& out) const;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback