xo-interpreter2 stack: define-expr's work at top-level

This commit is contained in:
Roland Conybeare 2026-02-17 14:42:17 -05:00
commit 6f3833d6fb
56 changed files with 1550 additions and 65 deletions

View file

@ -4,13 +4,16 @@
**/
#include "DDefineExpr.hpp"
#include "detail/IPrintable_DVariable.hpp"
#include "Variable.hpp"
#include <xo/gc/GCObject.hpp>
#include <xo/gc/PolyForwarderUtil.hpp>
#include <xo/printable2/Printable.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/scope.hpp>
#include <xo/indentlog/print/cond.hpp>
namespace xo {
using xo::mm::poly_forward_inplace;
using xo::print::APrintable;
using xo::facet::FacetRegistry;
using xo::facet::typeseq;
@ -68,10 +71,35 @@ namespace xo {
}
void
DDefineExpr::assign_rhs(obj<AExpression> x) {
DDefineExpr::assign_rhs(obj<AExpression> x)
{
this->rhs_ = x;
}
// ----- GCObject facet -----
std::size_t
DDefineExpr::shallow_size() const noexcept
{
return sizeof(*this);
}
DDefineExpr *
DDefineExpr::shallow_copy(obj<AAllocator> mm) const noexcept
{
return mm.std_copy_for(this);
}
std::size_t
DDefineExpr::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_inplace(&lhs_var_);
//gc.forward_inplace(&rhs_); // complicated - need to access via GCObject facet
poly_forward_inplace(gc, &rhs_);
return this->shallow_size();
}
bool
DDefineExpr::pretty(const ppindentinfo & ppii) const
{