Improve 'not implemented' error messages

This commit is contained in:
Nikita Lisitsa 2026-03-13 11:09:39 +03:00
parent 7f574eabbd
commit 0541068c2b
2 changed files with 12 additions and 7 deletions

View file

@ -6,7 +6,7 @@ namespace pslang::interpreter
value exec_foreign(context & context, void * pointer, types::type const & return_type, std::vector<value> args)
{
throw std::runtime_error("Not implemented");
throw std::runtime_error("exec_foreign is not implemented");
}
}

View file

@ -9,6 +9,7 @@
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <sstream>
namespace pslang::jit::aarch64
{
@ -256,7 +257,7 @@ namespace pslang::jit::aarch64
template <typename T>
void apply(T const &)
{
throw std::runtime_error("Not implemented");
throw std::runtime_error(std::string("reg_extend_visitor is not implemented for ") + typeid(T).name());
}
};
@ -298,7 +299,7 @@ namespace pslang::jit::aarch64
template <typename Node>
void apply(Node const &)
{
throw std::runtime_error("Not implemented");
throw std::runtime_error(std::string("compile_function_visitor is not implemented for ") + typeid(Node).name());
}
void apply(ast::bool_literal const & node)
@ -477,7 +478,7 @@ namespace pslang::jit::aarch64
break;
case ast::binary_operation_type::remainder:
// TODO: implement via div & mul & sub
throw std::runtime_error("Not implemented");
throw std::runtime_error("remainder operator is not implemented");
case ast::binary_operation_type::binary_and:
builder.and_reg(1, 0, 0);
break;
@ -599,7 +600,11 @@ namespace pslang::jit::aarch64
}
break;
default:
throw std::runtime_error("Not implemented");
{
std::ostringstream os;
os << "binary operation " << node.type << " is not implemented";
throw std::runtime_error(os.str());
}
}
}
@ -709,7 +714,7 @@ namespace pslang::jit::aarch64
{
auto identifier = std::get_if<ast::identifier>(node.lhs.get());
if (!identifier)
throw std::runtime_error("Not implemented");
throw std::runtime_error("assignment for non-identifier lhs is not implemented");
apply(*node.rhs);
@ -923,7 +928,7 @@ namespace pslang::jit::aarch64
template <typename Statement>
void apply(Statement const &)
{
throw std::runtime_error("Not implemented");
throw std::runtime_error(std::string("compile_visitor is not implemented for ") + typeid(Statement).name());
}
void apply(ast::function_definition const & node)