#include "expr/node_algorithm.h"
#include "expr/attribute.h"
+#include "expr/dtype.h"
namespace CVC4 {
namespace expr {
return visited[n];
}
+void getComponentTypes(
+ TypeNode t, std::unordered_set<TypeNode, TypeNodeHashFunction>& types)
+{
+ std::vector<TypeNode> toProcess;
+ toProcess.push_back(t);
+ do
+ {
+ TypeNode curr = toProcess.back();
+ toProcess.pop_back();
+ // if not already visited
+ if (types.find(t) == types.end())
+ {
+ types.insert(t);
+ // get component types from the children
+ for (unsigned i = 0, nchild = t.getNumChildren(); i < nchild; i++)
+ {
+ toProcess.push_back(t[i]);
+ }
+ }
+ } while (!toProcess.empty());
+}
+
} // namespace expr
} // namespace CVC4
std::vector<Node>& src,
std::vector<Node>& dest);
+/**
+ * Get component types in type t. This adds all types that are subterms of t
+ * when viewed as a term. For example, if t is (Array T1 T2), then
+ * (Array T1 T2), T1 and T2 are component types of t.
+ * @param t The type node under investigation
+ * @param types The set which component types are added to.
+ */
+void getComponentTypes(
+ TypeNode t, std::unordered_set<TypeNode, TypeNodeHashFunction>& types);
+
} // namespace expr
} // namespace CVC4