#include "Value.hpp" namespace roza { /*explicit*/ Value::Value(int value, SrcLoc loc) : m_type { std::make_shared(BaseType::TY_INT) } , m_int_val { value } , m_loc { loc } { } /*explicit*/ Value::Value(bool value, SrcLoc loc) : m_type { std::make_shared(BaseType::TY_BOOL) } , m_bool_val { value } , m_loc { loc } { } /*virtual*/ Value::~Value() { } std::string Value::string() const { if (m_type->equals(TY_INT)) { return std::to_string(m_int_val); } if (m_type->equals(TY_BOOL)) { return m_bool_val ? "true" : "false"; } assert("cannot stringify unknown value " && 0); } }