|
|
@ -340,7 +340,7 @@ struct case_strategy_data { |
|
|
|
std::vector<instruction_ptr>& into) { |
|
|
|
env_ptr new_env = env; |
|
|
|
for(auto it = repr.second->rbegin(); it != repr.second->rend(); it++) { |
|
|
|
new_env = env_ptr(new env_var(branch->expr->env->get_mangled_name(*it), new_env)); |
|
|
|
new_env = env_ptr(new env_var(*it, new_env)); |
|
|
|
} |
|
|
|
|
|
|
|
into.push_back(instruction_ptr(new instruction_split(repr.second->size()))); |
|
|
@ -392,7 +392,7 @@ void compile_case(const ast_case& node, const env_ptr& env, const type* type, st |
|
|
|
if(cases.defined_cases_count() == strategy.case_count(type)) |
|
|
|
throw type_error("redundant catch-all pattern", branch->pat->loc); |
|
|
|
auto& branch_into = cases.make_default_case(); |
|
|
|
env_ptr new_env(new env_var(branch->expr->env->get_mangled_name(vpat->var), env)); |
|
|
|
env_ptr new_env(new env_var(vpat->var, env)); |
|
|
|
branch->expr->compile(new_env, branch_into); |
|
|
|
branch_into.push_back(instruction_ptr(new instruction_slide(1))); |
|
|
|
} else { |
|
|
@ -484,7 +484,7 @@ void ast_let::compile(const env_ptr& env, std::vector<instruction_ptr>& into) co |
|
|
|
into.push_back(instruction_ptr(new instruction_alloc(translated_definitions.size()))); |
|
|
|
env_ptr new_env = env; |
|
|
|
for(auto& def : translated_definitions) { |
|
|
|
new_env = env_ptr(new env_var(definitions.env->get_mangled_name(def.first), std::move(new_env))); |
|
|
|
new_env = env_ptr(new env_var(def.first, std::move(new_env))); |
|
|
|
} |
|
|
|
int offset = translated_definitions.size() - 1; |
|
|
|
for(auto& def : translated_definitions) { |
|
|
|