From 6f156c048752e1f0e56202ed15a59bb306e04863 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sat, 28 Jun 2025 21:24:10 +0100 Subject: [PATCH] Add bool type to object --- cclox_src/scanner/object.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cclox_src/scanner/object.hh b/cclox_src/scanner/object.hh index 605cc6a..e32e85f 100644 --- a/cclox_src/scanner/object.hh +++ b/cclox_src/scanner/object.hh @@ -12,6 +12,7 @@ enum class StringObjectType : uint8_t { enum class ObjectType : uint8_t { NIL, + BOOL, IDENTIFIER, STRING_LIT, NUMBER, @@ -19,6 +20,7 @@ enum class ObjectType : uint8_t { struct Object { Object() : type{ObjectType::NIL}, value{std::monostate{}} {}; + Object(bool value) : type{ObjectType::BOOL}, value{value} {}; Object(double number) : type{ObjectType::NUMBER}, value{number} {}; Object(StringObjectType string_type, std::string value) : type{ @@ -29,7 +31,7 @@ struct Object { value{std::move(value)} {}; ObjectType type; - std::variant value; + std::variant value; }; std::ostream &operator<<(std::ostream &os, const ObjectType &type);