Fix vhdl_expr::cast when expression has no assigned type

This avoids a couple of segfaults
This commit is contained in:
Nick Gasson 2008-09-02 20:22:50 +01:00
parent ff766899b0
commit 4cb2090978
1 changed files with 5 additions and 0 deletions

View File

@ -33,6 +33,11 @@ vhdl_expr *vhdl_expr::cast(const vhdl_type *to)
// << " to=" << to->get_string() << " ("
// << to->get_width() << ")" << std::endl;
// If this expression hasn't been given a type then
// we can't generate any type conversion code
if (NULL == type_)
return this;
if (to->get_name() == type_->get_name()) {
if (to->get_width() == type_->get_width())
return this; // Identical