vhdlpp: VType::type_match() checks definitions provided by VTypeDef.
This commit is contained in:
parent
c6f934964f
commit
95044d9ac7
|
|
@ -356,6 +356,8 @@ class VTypeDef : public VType {
|
|||
|
||||
VType*clone() const { return new VTypeDef(*this); }
|
||||
|
||||
bool type_match(const VType*that) const;
|
||||
|
||||
inline perm_string peek_name() const { return name_; }
|
||||
|
||||
// If the type is not given a definition in the constructor,
|
||||
|
|
|
|||
|
|
@ -22,5 +22,21 @@
|
|||
|
||||
bool VType::type_match(const VType*that) const
|
||||
{
|
||||
return this == that;
|
||||
if(this == that)
|
||||
return true;
|
||||
|
||||
if(const VTypeDef*tdef = dynamic_cast<const VTypeDef*>(that)) {
|
||||
if(type_match(tdef->peek_definition()))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VTypeDef::type_match(const VType*that) const
|
||||
{
|
||||
if(VType::type_match(that))
|
||||
return true;
|
||||
|
||||
return VType::type_match(type_);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue