25 lines
519 B
C++
25 lines
519 B
C++
|
#include "NativeFunction.hpp"
|
||
|
|
||
|
namespace zn
|
||
|
{
|
||
|
/*explicit*/ NativeFunction::NativeFunction(std::shared_ptr<Prototype>
|
||
|
prototype,
|
||
|
native_fn_t body)
|
||
|
: m_prototype { prototype }
|
||
|
, m_body { body }
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/*virtual*/ NativeFunction::~NativeFunction()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
std::shared_ptr<Constant>
|
||
|
NativeFunction::call(std::vector<std::shared_ptr<Constant>> const& args)
|
||
|
{
|
||
|
assert(m_body);
|
||
|
return m_body(args);
|
||
|
}
|
||
|
|
||
|
}
|