From 43b3df00c8a40ab41d6b11d252df85c98509b005 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Sun, 12 Jun 2011 11:35:04 -0700 Subject: [PATCH] Better handle type probe of relation arguments. --- vhdlpp/expression_elaborate.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vhdlpp/expression_elaborate.cc b/vhdlpp/expression_elaborate.cc index 775a18ed0..feeb546c7 100644 --- a/vhdlpp/expression_elaborate.cc +++ b/vhdlpp/expression_elaborate.cc @@ -191,6 +191,11 @@ const VType* ExpName::probe_type(Entity*ent, Architecture*arc) const if (Signal*sig = arc->find_signal(name_)) return sig->peek_type(); + const VType*ctype = 0; + Expression*cval = 0; + if (arc->find_constant(name_, ctype, cval)) + return ctype; + cerr << get_fileline() << ": error: Signal/variable " << name_ << " not found in this context." << endl; return 0; @@ -222,6 +227,13 @@ const VType* ExpRelation::probe_type(Entity*ent, Architecture*arc) const if (type2 && !type1) return type2; + const VTypeArray*type1a = dynamic_cast(type1); + const VTypeArray*type2a = dynamic_cast(type2); + + if (type1a && type2a && type1a->element_type()==type2a->element_type()) { + return type1a->element_type(); + } + cerr << get_fileline() << ": error: Type mismatch in relation expression." << endl; return type1; }