diff --git a/code/compiler/13/ast.cpp b/code/compiler/13/ast.cpp index 2ad9d04..24e769a 100644 --- a/code/compiler/13/ast.cpp +++ b/code/compiler/13/ast.cpp @@ -55,9 +55,13 @@ void ast_lid::translate(global_scope& scope) { void ast_lid::compile(const env_ptr& env, std::vector& into) const { auto mangled_name = this->env->get_mangled_name(id); + + // Local names shouldn't need mangling. + assert(!(mangled_name != id && !this->env->is_global(id))); + into.push_back(instruction_ptr( (env->has_variable(mangled_name) && !this->env->is_global(id)) ? - (instruction*) new instruction_push(env->get_offset(mangled_name)) : + (instruction*) new instruction_push(env->get_offset(id)) : (instruction*) new instruction_pushglobal(mangled_name))); }