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.hpp

30 lines
470 B
C++

#ifndef jk_VALUE_HPP
#define jk_VALUE_HPP
#include "commons.hpp"
namespace jk
{
class Type;
class Value
{
public:
static std::shared_ptr<Value> make_nil();
static std::shared_ptr<Value> make_int(int val);
explicit Value() = default;
virtual ~Value() = default;
int as_int() const { return *m_int_val; }
std::weak_ptr<Type> type() const;
private:
std::shared_ptr<Type> m_type;
std::optional<int> m_int_val;
};
}
#endif