|
|
|
@ -43,7 +43,10 @@ void ast_lid::find_free(std::set<std::string>& into) { |
|
|
|
|
|
|
|
|
|
type_ptr ast_lid::typecheck(type_mgr& mgr, type_env_ptr& env) { |
|
|
|
|
this->env = env; |
|
|
|
|
return env->lookup(id)->instantiate(mgr); |
|
|
|
|
type_scheme_ptr lid_type = env->lookup(id); |
|
|
|
|
if(!lid_type) |
|
|
|
|
throw type_error(std::string("unknown identifier ") + id, loc); |
|
|
|
|
return lid_type->instantiate(mgr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ast_lid::translate(global_scope& scope) { |
|
|
|
@ -69,7 +72,10 @@ void ast_uid::find_free(std::set<std::string>& into) { |
|
|
|
|
|
|
|
|
|
type_ptr ast_uid::typecheck(type_mgr& mgr, type_env_ptr& env) { |
|
|
|
|
this->env = env; |
|
|
|
|
return env->lookup(id)->instantiate(mgr); |
|
|
|
|
type_scheme_ptr uid_type = env->lookup(id); |
|
|
|
|
if(!uid_type) |
|
|
|
|
throw type_error(std::string("unknown constructor ") + id, loc); |
|
|
|
|
return uid_type->instantiate(mgr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ast_uid::translate(global_scope& scope) { |
|
|
|
|