Include typedefs in checks for name collisions.
This requires us to make a copy of the typedefs map when adding it to a NetScope object, because the pform data is deleted before we are finished with it.
This commit is contained in:
parent
7445b424f1
commit
a17557575d
|
|
@ -119,7 +119,6 @@ NetScope::NetScope(NetScope*up, const hname_t&n, NetScope::TYPE t, NetScope*in_u
|
||||||
is_interface_(interface), is_unit_(compilation_unit), unit_(in_unit), up_(up)
|
is_interface_(interface), is_unit_(compilation_unit), unit_(in_unit), up_(up)
|
||||||
{
|
{
|
||||||
imports_ = 0;
|
imports_ = 0;
|
||||||
typedefs_ = 0;
|
|
||||||
events_ = 0;
|
events_ = 0;
|
||||||
lcounter_ = 0;
|
lcounter_ = 0;
|
||||||
is_auto_ = false;
|
is_auto_ = false;
|
||||||
|
|
@ -244,7 +243,7 @@ NetScope*NetScope::find_import(const Design*des, perm_string name)
|
||||||
void NetScope::add_typedefs(const map<perm_string,data_type_t*>*typedefs)
|
void NetScope::add_typedefs(const map<perm_string,data_type_t*>*typedefs)
|
||||||
{
|
{
|
||||||
if (!typedefs->empty())
|
if (!typedefs->empty())
|
||||||
typedefs_ = typedefs;
|
typedefs_ = *typedefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetScope*NetScope::find_typedef_scope(const Design*des, data_type_t*type)
|
NetScope*NetScope::find_typedef_scope(const Design*des, data_type_t*type)
|
||||||
|
|
@ -253,7 +252,7 @@ NetScope*NetScope::find_typedef_scope(const Design*des, data_type_t*type)
|
||||||
|
|
||||||
NetScope *cur_scope = this;
|
NetScope *cur_scope = this;
|
||||||
while (cur_scope) {
|
while (cur_scope) {
|
||||||
if (cur_scope->typedefs_ && cur_scope->typedefs_->find(type->name) != cur_scope->typedefs_->end())
|
if (cur_scope->typedefs_.find(type->name) != cur_scope->typedefs_.end())
|
||||||
return cur_scope;
|
return cur_scope;
|
||||||
NetScope*import_scope = cur_scope->find_import(des, type->name);
|
NetScope*import_scope = cur_scope->find_import(des, type->name);
|
||||||
if (import_scope)
|
if (import_scope)
|
||||||
|
|
@ -821,6 +820,8 @@ bool NetScope::symbol_exists(perm_string sym)
|
||||||
return true;
|
return true;
|
||||||
if (classes_.find(sym) != classes_.end())
|
if (classes_.find(sym) != classes_.end())
|
||||||
return true;
|
return true;
|
||||||
|
if (typedefs_.find(sym) != typedefs_.end())
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1281,7 +1281,7 @@ class NetScope : public Definitions, public Attrib {
|
||||||
|
|
||||||
const map<perm_string,PPackage*>*imports_;
|
const map<perm_string,PPackage*>*imports_;
|
||||||
|
|
||||||
const map<perm_string,data_type_t*>*typedefs_;
|
map<perm_string,data_type_t*>typedefs_;
|
||||||
|
|
||||||
NetEvent *events_;
|
NetEvent *events_;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue