diff --git a/vhdlpp/vtype.h b/vhdlpp/vtype.h index 89b794a13..7c5ec3aac 100644 --- a/vhdlpp/vtype.h +++ b/vhdlpp/vtype.h @@ -278,6 +278,7 @@ class VTypeRange : public VType { bool write_std_types(std::ostream&fd) const; int emit_def(std::ostream&out, perm_string name) const; + bool type_match(const VType*that) const; // Get the type that is limited by the range. inline const VType*base_type() const { return base_; } diff --git a/vhdlpp/vtype_match.cc b/vhdlpp/vtype_match.cc index 3ceb4b231..a4a49b1b5 100644 --- a/vhdlpp/vtype_match.cc +++ b/vhdlpp/vtype_match.cc @@ -85,3 +85,14 @@ bool VTypeArray::type_match(const VType*that) const return false; } + +bool VTypeRange::type_match(const VType*that) const +{ + if(VType::type_match(that)) + return true; + + if(base_->type_match(that)) + return true; + + return false; +}