From 839f9cd7aec62a5c2bbd79a868b8aa6e81d7e26f Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 22 Jan 2015 11:41:54 +0100 Subject: [PATCH] vhdlpp: Added ReturnStmt::cast_to() method. --- vhdlpp/sequential.cc | 7 +++++++ vhdlpp/sequential.h | 1 + 2 files changed, 8 insertions(+) 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_;