vhdlpp: ScopeBase::is_enum_name() returns VTypeEnum* instead of bool.

This commit is contained in:
Maciej Suminski 2015-05-07 14:42:31 +02:00
parent e4694cb6cb
commit 7db01d8ded
3 changed files with 13 additions and 12 deletions

View File

@ -1027,19 +1027,18 @@ const VType* ExpName::probe_type(Entity*ent, ScopeBase*scope) const
if (Variable*var = scope->find_variable(name_))
return var->peek_type();
const VType*ctype = 0;
const VType*type = 0;
Expression*cval = 0;
if (scope->find_constant(name_, ctype, cval))
return ctype;
if (scope->find_constant(name_, type, cval))
return type;
const VType*gtype = 0;
Architecture*arc = dynamic_cast<Architecture*>(scope);
if (arc && (gtype = arc->probe_genvar_type(name_))) {
return gtype;
if (arc && (type = arc->probe_genvar_type(name_))) {
return type;
}
if (scope->is_enum_name(name_)) {
return &primitive_INTEGER;
if ((type = scope->is_enum_name(name_))) {
return type;
}
}

View File

@ -188,15 +188,15 @@ Subprogram* ScopeBase::find_subprogram(perm_string name) const
return 0;
}
bool ScopeBase::is_enum_name(perm_string name) const
const VTypeEnum* ScopeBase::is_enum_name(perm_string name) const
{
for(list<const VTypeEnum*>::const_iterator it = use_enums_.begin();
it != use_enums_.end(); ++it) {
if((*it)->has_name(name))
return true;
return *it;
}
return false;
return NULL;
}
/*

View File

@ -58,7 +58,9 @@ class ScopeBase {
Variable* find_variable(perm_string by_name) const;
virtual const InterfacePort* find_param(perm_string by_name) const;
Subprogram* find_subprogram(perm_string by_name) const;
bool is_enum_name(perm_string name) const;
// Checks if a string is one of possible enum values. If so, the enum
// type is returned, otherwise NULL.
const VTypeEnum* is_enum_name(perm_string name) const;
// Moves signals, variables and components from another scope to
// this one. After the transfer new_* maps are cleared in the source scope.