From 150fa1e1827926ef2434c3befbe0385e2e74829c Mon Sep 17 00:00:00 2001 From: Riccardo De Benedictis Date: Mon, 11 Nov 2024 12:57:47 +0100 Subject: [PATCH] Refactor enum_item to use utils::var for value and update constructor accordingly --- extern/utils | 2 +- include/item.hpp | 8 ++++---- src/item.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extern/utils b/extern/utils index e7ee03d..01bb5be 160000 --- a/extern/utils +++ b/extern/utils @@ -1 +1 @@ -Subproject commit e7ee03da05c126908ca5deff0089a9feaaa03387 +Subproject commit 01bb5be2f79dcc4e70f8e37ede554fe05eaf2644 diff --git a/include/item.hpp b/include/item.hpp index 906e824..9cb6a27 100644 --- a/include/item.hpp +++ b/include/item.hpp @@ -94,15 +94,15 @@ namespace riddle class enum_item : public item, public env { public: - enum_item(type &t, std::size_t v); + enum_item(type &t, utils::var v); [[nodiscard]] std::shared_ptr get(std::string_view name) override; - [[nodiscard]] std::size_t &get_value() { return value; } - [[nodiscard]] const std::size_t &get_value() const { return value; } + [[nodiscard]] utils::var &get_value() { return value; } + [[nodiscard]] const utils::var &get_value() const { return value; } private: - std::size_t value; + utils::var value; }; class component : public item, public env diff --git a/src/item.cpp b/src/item.cpp index 45ddfad..346a259 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -32,7 +32,7 @@ namespace riddle string_item::string_item(string_type &t, const std::string &s) : item(t), value(s) {} - enum_item::enum_item(type &t, std::size_t v) : item(t), env(t.get_scope().get_core()), value(v) {} + enum_item::enum_item(type &t, utils::var v) : item(t), env(t.get_scope().get_core()), value(v) {} std::shared_ptr enum_item::get(std::string_view name) { return get_core().get(*this, name); } component::component(component_type &t, std::shared_ptr parent) : item(t), env(t.get_scope().get_core(), parent) {}