fakir/libstd/macro.cpp

26 lines
667 B
C++

#include "macro.hpp"
namespace fkstd
{
void assert_static_fail(Compiler& compiler,
std::shared_ptr<Node> node,
std::shared_ptr<Program> program)
{
try
{
compiler.compile_prog(node->child(1), program);
}
catch(std::exception const&)
{
program->load_const(std::make_shared<Constant>(TYPE_BOOL,
true,
node->loc()));
return;
}
std::stringstream ss;
ss << "assertion failed";
node->loc().error<assert_error>(LOG_ERROR, ss.str());
}
}