vhdlpp: VType::type_match() checks definitions provided by VTypeDef.

This commit is contained in:
Maciej Suminski 2015-06-22 14:00:24 +02:00
parent c6f934964f
commit 95044d9ac7
2 changed files with 19 additions and 1 deletions

View File

@ -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,

View File

@ -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_);
}