2023-09-20 15:17:13 +00:00
|
|
|
#ifndef fk_NATIVEFUNCTION_HPP
|
|
|
|
#define fk_NATIVEFUNCTION_HPP
|
|
|
|
|
|
|
|
#include "commons.hpp"
|
|
|
|
#include "Constant.hpp"
|
|
|
|
|
|
|
|
namespace fk
|
|
|
|
{
|
|
|
|
using native_t = std::function
|
2023-09-21 20:26:13 +00:00
|
|
|
<std::shared_ptr<Constant>(Loc, std::vector<std::shared_ptr<Constant>>)>;
|
2023-09-20 15:17:13 +00:00
|
|
|
|
|
|
|
class NativeFunction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit NativeFunction(native_t native);
|
|
|
|
virtual ~NativeFunction();
|
|
|
|
|
|
|
|
std::shared_ptr<Constant>
|
2023-09-21 20:26:13 +00:00
|
|
|
call(Loc const& loc, std::vector<std::shared_ptr<Constant>> args);
|
2023-09-20 15:17:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
native_t m_native;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|