vhdlpp: ScopeBase::is_enum_name() returns VTypeEnum* instead of bool.
This commit is contained in:
parent
e4694cb6cb
commit
7db01d8ded
|
|
@ -1027,19 +1027,18 @@ const VType* ExpName::probe_type(Entity*ent, ScopeBase*scope) const
|
||||||
if (Variable*var = scope->find_variable(name_))
|
if (Variable*var = scope->find_variable(name_))
|
||||||
return var->peek_type();
|
return var->peek_type();
|
||||||
|
|
||||||
const VType*ctype = 0;
|
const VType*type = 0;
|
||||||
Expression*cval = 0;
|
Expression*cval = 0;
|
||||||
if (scope->find_constant(name_, ctype, cval))
|
if (scope->find_constant(name_, type, cval))
|
||||||
return ctype;
|
return type;
|
||||||
|
|
||||||
const VType*gtype = 0;
|
|
||||||
Architecture*arc = dynamic_cast<Architecture*>(scope);
|
Architecture*arc = dynamic_cast<Architecture*>(scope);
|
||||||
if (arc && (gtype = arc->probe_genvar_type(name_))) {
|
if (arc && (type = arc->probe_genvar_type(name_))) {
|
||||||
return gtype;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scope->is_enum_name(name_)) {
|
if ((type = scope->is_enum_name(name_))) {
|
||||||
return &primitive_INTEGER;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,15 +188,15 @@ Subprogram* ScopeBase::find_subprogram(perm_string name) const
|
||||||
return 0;
|
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();
|
for(list<const VTypeEnum*>::const_iterator it = use_enums_.begin();
|
||||||
it != use_enums_.end(); ++it) {
|
it != use_enums_.end(); ++it) {
|
||||||
if((*it)->has_name(name))
|
if((*it)->has_name(name))
|
||||||
return true;
|
return *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ class ScopeBase {
|
||||||
Variable* find_variable(perm_string by_name) const;
|
Variable* find_variable(perm_string by_name) const;
|
||||||
virtual const InterfacePort* find_param(perm_string by_name) const;
|
virtual const InterfacePort* find_param(perm_string by_name) const;
|
||||||
Subprogram* find_subprogram(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
|
// Moves signals, variables and components from another scope to
|
||||||
// this one. After the transfer new_* maps are cleared in the source scope.
|
// this one. After the transfer new_* maps are cleared in the source scope.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue