xo-interpreter2 stack: define-expr's work at top-level
This commit is contained in:
parent
57f6f9073e
commit
6f3833d6fb
56 changed files with 1550 additions and 65 deletions
|
|
@ -9,7 +9,6 @@ set(SELF_SRCS
|
|||
DConstant.cpp
|
||||
DVariable.cpp
|
||||
DVarRef.cpp
|
||||
DDefineExpr.cpp
|
||||
DApplyExpr.cpp
|
||||
|
||||
TypeRef.cpp
|
||||
|
|
@ -30,7 +29,9 @@ set(SELF_SRCS
|
|||
IGCObject_DVarRef.cpp
|
||||
IPrintable_DVarRef.cpp
|
||||
|
||||
DDefineExpr.cpp
|
||||
IExpression_DDefineExpr.cpp
|
||||
IGCObject_DDefineExpr.cpp
|
||||
IPrintable_DDefineExpr.cpp
|
||||
|
||||
IExpression_DApplyExpr.cpp
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
39
xo-expression2/src/expression2/IGCObject_DDefineExpr.cpp
Normal file
39
xo-expression2/src/expression2/IGCObject_DDefineExpr.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/** @file IGCObject_DDefineExpr.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DDefineExpr.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DDefineExpr.json5]
|
||||
**/
|
||||
|
||||
#include "define/IGCObject_DDefineExpr.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DDefineExpr::shallow_size(const DDefineExpr & self) noexcept -> size_type
|
||||
{
|
||||
return self.shallow_size();
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DDefineExpr::shallow_copy(const DDefineExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DDefineExpr::forward_children(DDefineExpr & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
return self.forward_children(gc);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DDefineExpr.cpp */
|
||||
|
|
@ -6,17 +6,12 @@
|
|||
#include "expression2_register_facets.hpp"
|
||||
|
||||
#include <xo/expression2/UniqueString.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DUniqueString.hpp>
|
||||
//#include <xo/expression2/detail/IPrintable_DUniqueString.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IExpression_DDefineExpr.hpp>
|
||||
//#include <xo/expression2/detail/IGCObject_DDefineExpr.hpp>
|
||||
#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/DefineExpr.hpp>
|
||||
#include <xo/expression2/VarRef.hpp>
|
||||
#include <xo/expression2/Constant.hpp>
|
||||
#include <xo/expression2/ApplyExpr.hpp>
|
||||
|
|
@ -74,7 +69,7 @@ namespace xo {
|
|||
FacetRegistry::register_impl<APrintable, DVarRef>();
|
||||
|
||||
FacetRegistry::register_impl<AExpression, DDefineExpr>();
|
||||
//FacetRegistry::register_impl<AGCObject, DDefineExpr>();
|
||||
FacetRegistry::register_impl<AGCObject, DDefineExpr>();
|
||||
FacetRegistry::register_impl<APrintable, DDefineExpr>();
|
||||
|
||||
FacetRegistry::register_impl<AExpression, DApplyExpr>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue