fakir/src/NativeFunction.hpp

33 lines
621 B
C++
Raw Normal View History

2023-09-20 15:17:13 +00:00
#ifndef fk_NATIVEFUNCTION_HPP
#define fk_NATIVEFUNCTION_HPP
#include "commons.hpp"
#include "Constant.hpp"
namespace fk
{
2023-09-22 12:17:21 +00:00
class Module;
2023-09-20 15:17:13 +00:00
using native_t = std::function
2023-09-22 12:17:21 +00:00
<std::shared_ptr<Constant>(Loc,
Module&,
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-22 12:17:21 +00:00
call(Loc const& loc,
Module& mod,
std::vector<std::shared_ptr<Constant>> args);
2023-09-20 15:17:13 +00:00
private:
native_t m_native;
};
}
#endif