Skip to content

Commit

Permalink
Refactor enum_item to use std::size_t for value and update constructo…
Browse files Browse the repository at this point in the history
…r accordingly
  • Loading branch information
riccardodebenedictis committed Nov 11, 2024
1 parent 04a1a32 commit acf4576
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion extern/utils
8 changes: 4 additions & 4 deletions include/item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ namespace riddle
class enum_item : public item, public env
{
public:
enum_item(type &t, VARIABLE_TYPE v);
enum_item(type &t, std::size_t v);

[[nodiscard]] std::shared_ptr<item> get(std::string_view name) override;

[[nodiscard]] VARIABLE_TYPE &get_value() { return value; }
[[nodiscard]] const VARIABLE_TYPE &get_value() const { return value; }
[[nodiscard]] std::size_t &get_value() { return value; }
[[nodiscard]] const std::size_t &get_value() const { return value; }

private:
VARIABLE_TYPE value;
std::size_t value;
};

class component : public item, public env
Expand Down
2 changes: 1 addition & 1 deletion src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, VARIABLE_TYPE v) : item(t), env(t.get_scope().get_core()), value(v) {}
enum_item::enum_item(type &t, std::size_t v) : item(t), env(t.get_scope().get_core()), value(v) {}
std::shared_ptr<item> enum_item::get(std::string_view name) { return get_core().get(*this, name); }

component::component(component_type &t, std::shared_ptr<env> parent) : item(t), env(t.get_scope().get_core(), parent) {}
Expand Down

0 comments on commit acf4576

Please sign in to comment.