Add bool type to object
This commit is contained in:
		@@ -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<std::monostate, std::string, double> value;
 | 
			
		||||
  std::variant<std::monostate, std::string, double, bool> value;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
std::ostream &operator<<(std::ostream &os, const ObjectType &type);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user