Write up type code
This commit is contained in:
@@ -15,11 +15,11 @@ struct type_var : public type {
|
||||
: name(std::move(n)) {}
|
||||
};
|
||||
|
||||
struct type_id : public type {
|
||||
int id;
|
||||
struct type_base : public type {
|
||||
std::string name;
|
||||
|
||||
type_id(int i)
|
||||
: id(i) {}
|
||||
type_base(std::string n)
|
||||
: name(std::move(n)) {}
|
||||
};
|
||||
|
||||
struct type_arr : public type {
|
||||
@@ -32,8 +32,13 @@ struct type_arr : public type {
|
||||
|
||||
struct type_mgr {
|
||||
int last_id = 0;
|
||||
std::map<std::string, type_ptr> types;
|
||||
|
||||
std::string new_type_name();
|
||||
type_ptr new_type();
|
||||
type_ptr new_arrow_type();
|
||||
|
||||
void unify(type_ptr l, type_ptr r);
|
||||
type_ptr resolve(type_ptr t, type_var*& var);
|
||||
void bind(std::string s, type_ptr t);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user