diff --git a/vhdlpp/sequential.cc b/vhdlpp/sequential.cc index 85b874a83..dc6043d70 100644 --- a/vhdlpp/sequential.cc +++ b/vhdlpp/sequential.cc @@ -19,6 +19,7 @@ # include "sequential.h" # include "expression.h" +# include template inline static void visit_stmt_list(std::list& stmts, SeqStmtVisitor& func) @@ -195,6 +196,12 @@ ReturnStmt::~ReturnStmt() delete val_; } +void ReturnStmt::cast_to(const VType*type) +{ + assert(val_); + val_ = new ExpCast(val_, type); +} + LoopStatement::LoopStatement(perm_string name, list* stmts) : name_(name) { diff --git a/vhdlpp/sequential.h b/vhdlpp/sequential.h index 387041b70..6edd2321e 100644 --- a/vhdlpp/sequential.h +++ b/vhdlpp/sequential.h @@ -134,6 +134,7 @@ class ReturnStmt : public SequentialStmt { void dump(ostream&out, int indent) const; const Expression*peek_expr() const { return val_; }; + void cast_to(const VType*type); private: Expression*val_;