From fca2fff24e8ca3fac4005c53639a78e858d7d1fb Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 17 Feb 2016 13:56:25 +0100 Subject: [PATCH] vhdlpp: VTypeRange::type_match() --- vhdlpp/vtype.h | 1 + vhdlpp/vtype_match.cc | 11 +++++++++++ 2 files changed, 12 insertions(+) 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; +}