From e33a330129364b4bd632b2fd531a996b8c57cefb Mon Sep 17 00:00:00 2001 From: hop311 Date: Wed, 17 Jan 2024 22:24:39 +0000 Subject: Parse missing variables, Logger counting, misc cleanup --- src/openvic-simulation/types/IdentifierRegistry.hpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/openvic-simulation/types/IdentifierRegistry.hpp') diff --git a/src/openvic-simulation/types/IdentifierRegistry.hpp b/src/openvic-simulation/types/IdentifierRegistry.hpp index bbaf52c..251632b 100644 --- a/src/openvic-simulation/types/IdentifierRegistry.hpp +++ b/src/openvic-simulation/types/IdentifierRegistry.hpp @@ -232,7 +232,7 @@ namespace OpenVic { } } - constexpr static NodeTools::KeyValueCallback auto key_value_invalid_callback(std::string_view name) { + static constexpr NodeTools::KeyValueCallback auto key_value_invalid_callback(std::string_view name) { return [name](std::string_view key, ast::NodeCPtr) { Logger::error("Invalid ", name, ": ", key); return false; @@ -258,13 +258,7 @@ namespace OpenVic { if (item != nullptr) { \ return callback(*item); \ } \ - if (!warn) { \ - Logger::error("Invalid ", name, ": ", identifier); \ - return false; \ - } else { \ - Logger::warning("Invalid ", name, ": ", identifier); \ - return true; \ - } \ + return NodeTools::warn_or_error(warn, "Invalid ", name, ": ", identifier); \ }; \ } \ constexpr NodeTools::NodeCallback auto expect_item_identifier( \ -- cgit v1.2.3-56-ga3b1