From 72f5e82196d95008ed12c12de6bdccf24361e106 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Mon, 7 Sep 2026 22:02:15 +0200 Subject: Make module entry point more procedure like --- boot/dependency.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'boot/dependency.cc') diff --git a/boot/dependency.cc b/boot/dependency.cc index 9b52ce9..1eb5953 100644 --- a/boot/dependency.cc +++ b/boot/dependency.cc @@ -26,15 +26,23 @@ along with GCC; see the file COPYING3. If not see namespace elna::boot { - circular_import_error::circular_import_error(const source_position position, - const std::string& module_name) - : diagnostic(position), module_name(module_name) + import_error::import_error(const source_position position, + const std::string& module_name, const kind payload) + : diagnostic(position), module_name(module_name), m_payload(payload) { } - std::string circular_import_error::what() const + std::string import_error::what() const { - return "Circular import of module '" + this->module_name + "'"; + switch (this->m_payload) + { + case kind::circular: + return "Circular import of module '" + this->module_name + "'"; + case kind::program: + return "Module '" + this->module_name + "' is a program and cannot be imported"; + default: + __builtin_unreachable(); + } } read_result read_source(std::istream& entry_point, const target_info& target) -- cgit v1.2.3