26 lines
521 B
C++
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;
|
|
}
|
|
}
|