Make a few more things classes.

This commit is contained in:
2020-09-17 18:30:41 -07:00
parent 5e13047846
commit 7a631b3557
7 changed files with 54 additions and 49 deletions

View File

@@ -415,7 +415,7 @@ void compile_case(const ast_case& node, const env_ptr& env, const type* type, st
void ast_case::compile(const env_ptr& env, std::vector<instruction_ptr>& into) const {
type_app* app_type = dynamic_cast<type_app*>(input_type.get());
type_data* data;
type_internal* internal;
type_base *base;
of->compile(env, into);
into.push_back(instruction_ptr(new instruction_eval()));
@@ -423,11 +423,11 @@ void ast_case::compile(const env_ptr& env, std::vector<instruction_ptr>& into) c
if(app_type && (data = dynamic_cast<type_data*>(app_type->constructor.get()))) {
compile_case<case_strategy_data>(*this, env, data, into);
return;
} else if(app_type && (internal = dynamic_cast<type_internal*>(app_type->constructor.get()))) {
if(internal->name == "Bool") {
compile_case<case_strategy_bool>(*this, env, data, into);
return;
}
} else if (app_type && (base = dynamic_cast<type_base *>(app_type->constructor.get()))) {
if (base->name == "Bool") {
compile_case<case_strategy_bool>(*this, env, data, into);
return;
}
}
throw type_error("attempting unsupported case analysis", of->loc);