Properly set up scope prefix instead of hacking it away
This commit is contained in:
parent
4c0915f925
commit
aa40d591d1
|
@ -165,10 +165,9 @@ const symbolt &cpp_typecheckt::class_template_symbol(
|
||||||
INVARIANT_STRUCTURED(
|
INVARIANT_STRUCTURED(
|
||||||
template_scope!=nullptr, nullptr_exceptiont, "template_scope is null");
|
template_scope!=nullptr, nullptr_exceptiont, "template_scope is null");
|
||||||
|
|
||||||
irep_idt identifier=
|
irep_idt identifier = id2string(template_scope->get_parent().prefix) +
|
||||||
id2string(template_scope->prefix)+
|
"tag-" + id2string(template_symbol.base_name) +
|
||||||
"tag-"+id2string(template_symbol.base_name)+
|
id2string(suffix);
|
||||||
id2string(suffix);
|
|
||||||
|
|
||||||
// already there?
|
// already there?
|
||||||
symbol_tablet::symbolst::const_iterator s_it=
|
symbol_tablet::symbolst::const_iterator s_it=
|
||||||
|
@ -205,9 +204,8 @@ const symbolt &cpp_typecheckt::class_template_symbol(
|
||||||
|
|
||||||
id.id_class=cpp_idt::id_classt::CLASS;
|
id.id_class=cpp_idt::id_classt::CLASS;
|
||||||
id.is_scope=true;
|
id.is_scope=true;
|
||||||
id.prefix=template_scope->prefix+
|
id.prefix = template_scope->get_parent().prefix +
|
||||||
id2string(s_ptr->base_name)+
|
id2string(s_ptr->base_name) + id2string(suffix) + "::";
|
||||||
id2string(suffix)+"::";
|
|
||||||
id.class_identifier=s_ptr->name;
|
id.class_identifier=s_ptr->name;
|
||||||
id.id_class=cpp_idt::id_classt::CLASS;
|
id.id_class=cpp_idt::id_classt::CLASS;
|
||||||
|
|
||||||
|
|
|
@ -719,11 +719,7 @@ cpp_scopet &cpp_typecheckt::typecheck_template_parameters(
|
||||||
std::string id_suffix="template::"+std::to_string(template_counter++);
|
std::string id_suffix="template::"+std::to_string(template_counter++);
|
||||||
|
|
||||||
// produce a new scope for the template parameters
|
// produce a new scope for the template parameters
|
||||||
cpp_scopet &template_scope=
|
cpp_scopet &template_scope = cpp_scopes.current_scope().new_scope(id_suffix);
|
||||||
cpp_scopes.current_scope().new_scope(
|
|
||||||
cpp_scopes.current_scope().prefix+id_suffix);
|
|
||||||
|
|
||||||
template_scope.prefix=template_scope.get_parent().prefix+id_suffix;
|
|
||||||
template_scope.id_class=cpp_idt::id_classt::TEMPLATE_SCOPE;
|
template_scope.id_class=cpp_idt::id_classt::TEMPLATE_SCOPE;
|
||||||
|
|
||||||
cpp_scopes.go_to(template_scope);
|
cpp_scopes.go_to(template_scope);
|
||||||
|
@ -826,9 +822,6 @@ cpp_scopet &cpp_typecheckt::typecheck_template_parameters(
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// continue without adding to the prefix
|
|
||||||
template_scope.prefix=template_scope.get_parent().prefix;
|
|
||||||
|
|
||||||
return template_scope;
|
return template_scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue