xo-expression: refactor: Lambda/Primitive share FunctionInterface
This commit is contained in:
parent
0595c7c74e
commit
5c4b062cf8
6 changed files with 63 additions and 22 deletions
|
|
@ -5,30 +5,27 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "ConstantInterface.hpp"
|
||||
#include "FunctionInterface.hpp"
|
||||
|
||||
//#include <cstdint>
|
||||
|
||||
#include <type_traits>
|
||||
namespace xo {
|
||||
namespace ast {
|
||||
class PrimitiveInterface : public ConstantInterface {
|
||||
class PrimitiveInterface : public FunctionInterface {
|
||||
public:
|
||||
PrimitiveInterface(TypeDescr fn_type)
|
||||
: ConstantInterface(exprtype::primitive, fn_type) {}
|
||||
: FunctionInterface(exprtype::primitive, fn_type) {}
|
||||
|
||||
/** downcast from Expression **/
|
||||
static ref::brw<PrimitiveInterface> from(ref::brw<Expression> x) {
|
||||
return ref::brw<PrimitiveInterface>::from(x);
|
||||
}
|
||||
|
||||
virtual const std::string & name() const = 0;
|
||||
int n_arg() const { return this->value_td()->n_fn_arg(); }
|
||||
TypeDescr fn_retval() const { return this->value_td()->fn_retval(); }
|
||||
TypeDescr fn_arg(uint32_t i) const { return this->value_td()->fn_arg(i); }
|
||||
|
||||
//virtual TypeDescr value_td() const override = 0;
|
||||
//virtual TaggedPtr value_tp() const override = 0;
|
||||
// virtual const std::string & name() const;
|
||||
// virtual int n_arg() const;
|
||||
// virtual TypeDescr fn_retval() const;
|
||||
// virtual TypeDescr fn_arg(uint32_t i) const;
|
||||
|
||||
private:
|
||||
}; /*PrimitiveInterface*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue