This repository has been archived on 2023-09-10. You can view files and clone it, but cannot push or open issues/pull-requests.
joko/lib/Value.cpp

26 lines
521 B
C++

#include "Value.hpp"
#include "Type.hpp"
namespace jk
{
/*static*/ std::shared_ptr<Value> Value::make_nil()
{
auto value = std::make_shared<Value>();
value->m_type = std::make_shared<Type>(TYPE_NIL);
return value;
}
/*static*/ std::shared_ptr<Value> Value::make_int(int val)
{
auto value = std::make_shared<Value>();
value->m_type = std::make_shared<Type>(TYPE_INT);
value->m_int_val = val;
return value;
}
std::weak_ptr<Type> Value::type() const
{
return m_type;
}
}