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

@ -19,6 +19,7 @@ set(SELF_SRCS
IPrintable_DConstant.cpp
IExpression_DVariable.cpp
IGCObject_DVariable.cpp
IPrintable_DVariable.cpp
IExpression_DDefineExpr.cpp

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
{

View file

@ -0,0 +1,39 @@
/** @file IGCObject_DVariable.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DVariable.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DVariable.json5]
**/
#include "detail/IGCObject_DVariable.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DVariable::shallow_size(const DVariable & self) noexcept -> size_type
{
return self.shallow_size();
}
auto
IGCObject_DVariable::shallow_copy(const DVariable & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DVariable::forward_children(DVariable & self, obj<ACollector> gc) noexcept -> size_type
{
return self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DVariable.cpp */

View file

@ -12,6 +12,7 @@
#include <xo/expression2/detail/IPrintable_DDefineExpr.hpp>
#include <xo/expression2/detail/IExpression_DVariable.hpp>
#include <xo/expression2/detail/IGCObject_DVariable.hpp>
#include <xo/expression2/detail/IPrintable_DVariable.hpp>
#include <xo/expression2/detail/IExpression_DConstant.hpp>
@ -58,6 +59,7 @@ namespace xo {
FacetRegistry::register_impl<APrintable, DConstant>();
FacetRegistry::register_impl<AExpression, DVariable>();
FacetRegistry::register_impl<AGCObject, DVariable>();
FacetRegistry::register_impl<APrintable, DVariable>();
FacetRegistry::register_impl<AExpression, DDefineExpr>();