xo-expression2: AGCObject support for DVariable

This commit is contained in:
Roland Conybeare 2026-01-29 10:16:13 -05:00
commit a26b781101
8 changed files with 176 additions and 0 deletions

View file

@ -5,9 +5,11 @@
#include "DVariable.hpp"
#include "exprtype.hpp"
#include <cstddef>
#include <xo/indentlog/print/quoted.hpp>
namespace xo {
using xo::mm::ACollector;
using xo::facet::typeseq;
namespace scm {
@ -36,6 +38,35 @@ namespace xo {
typeref_.resolve(td);
}
size_t
DVariable::shallow_size() const noexcept
{
return sizeof(DVariable);
}
DVariable *
DVariable::shallow_copy(obj<AAllocator> mm) const noexcept
{
DVariable * copy = (DVariable *)mm.alloc_copy((std::byte *)this);
if (copy) {
*copy = *this;
}
return copy;
}
size_t
DVariable::forward_children(obj<ACollector>) noexcept
{
// nothing to collect.
// - DUniqueString never in GC space
// - TypeDescr not in GC space
// - path only integers
return shallow_size();
}
bool
DVariable::pretty(const ppindentinfo & ppii) const
{