From 0541068c2ba15304fd621dbfe3a08f774833a876 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Fri, 13 Mar 2026 11:09:39 +0300 Subject: [PATCH] Improve 'not implemented' error messages --- libs/interpreter/source/foreign.cpp | 2 +- libs/jit/source/arch/aarch64/compiler.cpp | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/libs/interpreter/source/foreign.cpp b/libs/interpreter/source/foreign.cpp index 31204fb..9019544 100644 --- a/libs/interpreter/source/foreign.cpp +++ b/libs/interpreter/source/foreign.cpp @@ -6,7 +6,7 @@ namespace pslang::interpreter value exec_foreign(context & context, void * pointer, types::type const & return_type, std::vector args) { - throw std::runtime_error("Not implemented"); + throw std::runtime_error("exec_foreign is not implemented"); } } \ No newline at end of file diff --git a/libs/jit/source/arch/aarch64/compiler.cpp b/libs/jit/source/arch/aarch64/compiler.cpp index 9ed3e9a..dcfa948 100644 --- a/libs/jit/source/arch/aarch64/compiler.cpp +++ b/libs/jit/source/arch/aarch64/compiler.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace pslang::jit::aarch64 { @@ -256,7 +257,7 @@ namespace pslang::jit::aarch64 template 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 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(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 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)