refactor: use GCObjectVisitor api w/ gco_shallow_move

This commit is contained in:
Roland Conybeare 2026-04-06 15:21:48 -04:00
commit 997d3d8264
44 changed files with 89 additions and 133 deletions

View file

@ -104,13 +104,8 @@ namespace xo {
// ----- gcobject facet -----
std::size_t
DApplyExpr::shallow_size() const noexcept {
return sizeof(DApplyExpr) + (n_args_ * sizeof(obj<AExpression>));
}
DApplyExpr *
DApplyExpr::shallow_move(obj<ACollector> gc) noexcept {
DApplyExpr::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept {
// note: not using ACollector.std_copy_for() here,
// flexible array -> not move-constructible

View file

@ -71,14 +71,8 @@ namespace xo {
return nullptr;
}
std::size_t
DConstant::shallow_size() const noexcept
{
return sizeof(DConstant);
}
DConstant *
DConstant::shallow_move(obj<ACollector> gc) noexcept
DConstant::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -78,14 +78,8 @@ namespace xo {
// ----- GCObject facet -----
std::size_t
DDefineExpr::shallow_size() const noexcept
{
return sizeof(*this);
}
DDefineExpr *
DDefineExpr::shallow_move(obj<ACollector> gc) noexcept
DDefineExpr::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -263,7 +263,7 @@ namespace xo {
// ----- gcobject facet -----
DGlobalSymtab *
DGlobalSymtab::shallow_move(obj<ACollector> gc) noexcept
DGlobalSymtab::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -82,14 +82,8 @@ namespace xo {
// GCObject facet
std::size_t
DIfElseExpr::shallow_size() const noexcept
{
return sizeof(DIfElseExpr);
}
DIfElseExpr *
DIfElseExpr::shallow_move(obj<ACollector> gc) noexcept
DIfElseExpr::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -141,7 +141,7 @@ namespace xo {
}
DLambdaExpr *
DLambdaExpr::shallow_move(obj<ACollector> gc) noexcept {
DLambdaExpr::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept {
return gc.std_move_for(this);
}

View file

@ -113,7 +113,7 @@ namespace xo {
// ----- gcobject facet -----
DLocalSymtab *
DLocalSymtab::shallow_move(obj<ACollector> gc) noexcept
DLocalSymtab::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -113,14 +113,8 @@ namespace xo {
// gc hooks for IGCObject_DSequenceExpr
std::size_t
DSequenceExpr::shallow_size() const noexcept
{
return sizeof(DSequenceExpr);
}
DSequenceExpr *
DSequenceExpr::shallow_move(obj<ACollector> gc) noexcept
DSequenceExpr::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -40,14 +40,8 @@ namespace xo {
: name_{name}, type_{type}
{}
size_t
DTypename::shallow_size() const noexcept
{
return sizeof(DTypename);
}
DTypename *
DTypename::shallow_move(obj<ACollector> gc) noexcept
DTypename::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -58,14 +58,8 @@ namespace xo {
// gcobject facet
std::size_t
DVarRef::shallow_size() const noexcept
{
return sizeof(DVarRef);
}
DVarRef *
DVarRef::shallow_move(obj<ACollector> gc) noexcept
DVarRef::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -38,14 +38,8 @@ namespace xo {
typeref_.resolve(td);
}
size_t
DVariable::shallow_size() const noexcept
{
return sizeof(DVariable);
}
DVariable *
DVariable::shallow_move(obj<ACollector> gc) noexcept
DVariable::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DApplyExpr::shallow_move(DApplyExpr & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DApplyExpr::gco_shallow_move(DApplyExpr & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DApplyExpr::visit_gco_children(DApplyExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DConstant::shallow_move(DConstant & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DConstant::gco_shallow_move(DConstant & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DConstant::visit_gco_children(DConstant & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DDefineExpr::shallow_move(DDefineExpr & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DDefineExpr::gco_shallow_move(DDefineExpr & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DDefineExpr::visit_gco_children(DDefineExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DGlobalSymtab::shallow_move(DGlobalSymtab & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DGlobalSymtab::gco_shallow_move(DGlobalSymtab & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DGlobalSymtab::visit_gco_children(DGlobalSymtab & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DIfElseExpr::shallow_move(DIfElseExpr & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DIfElseExpr::gco_shallow_move(DIfElseExpr & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DIfElseExpr::visit_gco_children(DIfElseExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DLambdaExpr::shallow_move(DLambdaExpr & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DLambdaExpr::gco_shallow_move(DLambdaExpr & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DLambdaExpr::visit_gco_children(DLambdaExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DLocalSymtab::shallow_move(DLocalSymtab & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DLocalSymtab::gco_shallow_move(DLocalSymtab & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DLocalSymtab::visit_gco_children(DLocalSymtab & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DSequenceExpr::shallow_move(DSequenceExpr & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DSequenceExpr::gco_shallow_move(DSequenceExpr & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DSequenceExpr::visit_gco_children(DSequenceExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DTypename::shallow_move(DTypename & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DTypename::gco_shallow_move(DTypename & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DTypename::visit_gco_children(DTypename & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DVarRef::shallow_move(DVarRef & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DVarRef::gco_shallow_move(DVarRef & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DVarRef::visit_gco_children(DVarRef & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DVariable::shallow_move(DVariable & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DVariable::gco_shallow_move(DVariable & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.shallow_move(gc);
return self.gco_shallow_move(gc);
}
auto
IGCObject_DVariable::visit_gco_children(DVariable & self, obj<AGCObjectVisitor> fn) noexcept -> void