This repository has been archived on 2024-03-07. You can view files and clone it, but cannot push or open issues/pull-requests.
2023-09-18 17:08:32 +00:00
|
|
|
#include "macro.hpp"
|
|
|
|
|
2023-09-18 17:32:16 +00:00
|
|
|
void assert_fail(Node const& node,
|
|
|
|
Compiler& compiler,
|
|
|
|
Program& program,
|
|
|
|
SymTable&)
|
2023-09-18 17:08:32 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
compiler.compile(*node.child_at(1), program);
|
|
|
|
Loc loc = node.loc();
|
|
|
|
|
|
|
|
std::cerr << loc.file_path().string() << ":" << loc.line();
|
|
|
|
std::cerr << " ASSERTION FAILED" << std::endl;
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
catch (std::exception const&)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-09-18 17:32:16 +00:00
|
|
|
size_t addr = program.add_constant(std::make_shared<Constant>
|
|
|
|
(TYPE_NIL, node.loc(), 0));
|
|
|
|
program.append(OPCODE_LOAD_CONST, addr);
|
2023-09-18 17:08:32 +00:00
|
|
|
}
|