From 0ae3414ec5db6dde79f4cdb7d98a1337d8c6554e Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Sun, 9 Aug 2015 18:15:50 +0200 Subject: [PATCH] vhdlpp: ExpUnary::elaborate_expr() elaborates its operand as well. Fix for br985. --- vhdlpp/expression.h | 2 +- vhdlpp/expression_elaborate.cc | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/vhdlpp/expression.h b/vhdlpp/expression.h index 803b63b49..553c6b9c4 100644 --- a/vhdlpp/expression.h +++ b/vhdlpp/expression.h @@ -168,6 +168,7 @@ class ExpUnary : public Expression { inline const Expression*peek_operand() const { return operand1_; } const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const; + int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void visit(ExprVisitor& func); protected: @@ -825,7 +826,6 @@ class ExpUNot : public ExpUnary { Expression*clone() const { return new ExpUNot(peek_operand()->clone()); } - int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype); void write_to_stream(std::ostream&fd) const; int emit(ostream&out, Entity*ent, ScopeBase*scope); void dump(ostream&out, int indent = 0) const; diff --git a/vhdlpp/expression_elaborate.cc b/vhdlpp/expression_elaborate.cc index c2d334af2..131c0e5d1 100644 --- a/vhdlpp/expression_elaborate.cc +++ b/vhdlpp/expression_elaborate.cc @@ -373,6 +373,13 @@ const VType*ExpUnary::fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*aty return operand1_->fit_type(ent, scope, atype); } +int ExpUnary::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) +{ + ivl_assert(*this, ltype != 0); + set_type(ltype); + return operand1_->elaborate_expr(ent, scope, ltype); +} + const VType*ExpAggregate::probe_type(Entity*ent, ScopeBase*scope) const { return Expression::probe_type(ent, scope); @@ -1043,14 +1050,6 @@ int ExpString::elaborate_expr(Entity*, ScopeBase*, const VType*ltype) return 0; } -int ExpUNot::elaborate_expr(Entity*, ScopeBase*, const VType*ltype) -{ - ivl_assert(*this, ltype != 0); - set_type(ltype); - return 0; -} - - int ExpTime::elaborate_expr(Entity*, ScopeBase*, const VType*) { set_type(&primitive_INTEGER);