diff --git a/src/Type.h b/src/Type.h index 7261a445f4..da455ee6c3 100644 --- a/src/Type.h +++ b/src/Type.h @@ -341,6 +341,9 @@ public: void Append(TypePtr t); void AppendEvenIfNotPure(TypePtr t); + // Resets the list to be empty. + void Clear() { types.clear(); } + detail::TraversalCode Traverse(detail::TraversalCallback* cb) const override; protected: diff --git a/src/Val.h b/src/Val.h index 1267f602ec..f4e177d602 100644 --- a/src/Val.h +++ b/src/Val.h @@ -684,6 +684,15 @@ public: */ void Append(ValPtr v); + /** + * Empties the list. + * @param v the value to append. + */ + void Clear() { + vals.clear(); + type->AsTypeList()->Clear(); + } + // Returns a Set representation of the list (which must be homogeneous). TableValPtr ToSetVal() const;