+ xo-interpreter2 scaffold for constant expression [WIP]
This commit is contained in:
parent
ceb75e83c4
commit
3cbbe5ab63
13 changed files with 232 additions and 24 deletions
|
|
@ -3,7 +3,10 @@
|
|||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include <xo/reflect/TypeDescr.hpp>
|
||||
#include "TypeRef.hpp"
|
||||
#include "exprtype.hpp"
|
||||
#include <xo/reflect/TaggedPtr.hpp>
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
|
@ -12,24 +15,36 @@ namespace xo {
|
|||
**/
|
||||
struct DConstant {
|
||||
public:
|
||||
using TaggedPtr = xo::reflect::TaggedPtr;
|
||||
using TypeDescr = xo::reflect::TypeDescr;
|
||||
using AGCObject = xo::mm::AGCObject;
|
||||
using typeseq = xo::reflect::typeseq;
|
||||
|
||||
public:
|
||||
DConstant(TypeDescr td, void * value);
|
||||
explicit DConstant(obj<AGCObject> value) noexcept;
|
||||
|
||||
TypeDescr value_td() const { return value_td; }
|
||||
bool is_resolved() const noexcept { return typeref_.is_resolved(); }
|
||||
|
||||
TypeRef typeref() const noexcept;
|
||||
TypeDescr valuetype() const noexcept;
|
||||
void assign_valuetype(TypeDescr td) noexcept;
|
||||
exprtype extype() const noexcept { return exprtype::constant; }
|
||||
TypeDescr value_td() const noexcept { return typeref_.td(); }
|
||||
TaggedPtr value_tp() const noexcept { return TaggedPtr(typeref_.td(), value_.data()); }
|
||||
|
||||
TypeRef typeref() const noexcept { return typeref_; }
|
||||
TypeDescr valuetype() const noexcept { return typeref_.td(); }
|
||||
obj<AGCObject> value() const noexcept { return value_; }
|
||||
|
||||
void assign_valuetype(TypeDescr td) noexcept { typeref_.resolve(td); }
|
||||
|
||||
private:
|
||||
/** type for value of this expression **/
|
||||
TypeRef type_ref_;
|
||||
/** type description for destination *value_ **/
|
||||
TypeDescr valuetype_;
|
||||
static TypeDescr _lookup_td(typeseq tseq);
|
||||
|
||||
private:
|
||||
/** type for value of this expression
|
||||
* or unification breadcrumb before unification
|
||||
**/
|
||||
TypeRef typeref_;
|
||||
/** literal value **/
|
||||
void * value_;
|
||||
obj<AGCObject> value_;
|
||||
};
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue