Browse Source

Add assertion regarding local name mangling.

search
Danila Fedorin 2 years ago
parent
commit
17c59e595c
  1. 6
      code/compiler/13/ast.cpp

6
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<instruction_ptr>& 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)));
}

Loading…
Cancel
Save