xo-expression2: + GCObject,Printable facets for DSequenceExpr

This commit is contained in:
Roland Conybeare 2026-01-31 12:40:50 -05:00
commit 440d43e109
57 changed files with 348 additions and 46 deletions

View file

@ -5,6 +5,7 @@
#include "DSequenceExpr.hpp"
#include "detail/IExpression_DSequenceExpr.hpp"
#include <xo/object2/array/IGCObject_DArray.hpp>
#include <xo/gc/GCObject.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/printable2/Printable.hpp>
@ -99,6 +100,39 @@ namespace xo {
"DSequenceExpr");
}
// gc hooks for IGCObject_DSequenceExpr
std::size_t
DSequenceExpr::shallow_size() const noexcept
{
return sizeof(DSequenceExpr);
}
DSequenceExpr *
DSequenceExpr::shallow_copy(obj<AAllocator> mm) const noexcept
{
DSequenceExpr * copy = (DSequenceExpr *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;
return copy;
}
std::size_t
DSequenceExpr::forward_children(obj<ACollector> gc) noexcept
{
// WARNING.
// if this proves problematic,
// may resort to obj<AGCObject,DArray> for expr_v_ member
auto iface = facet::impl_for<AGCObject,DArray>();
gc.forward_inplace(&iface, (void**)&expr_v_);
return shallow_size();
}
} /*namespace scm*/
} /*namespace xo*/