vhdlpp: Added ReturnStmt::cast_to() method.

This commit is contained in:
Maciej Suminski 2015-01-22 11:41:54 +01:00
parent b8b2f53027
commit 839f9cd7ae
2 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,7 @@
# include "sequential.h"
# include "expression.h"
# include <cassert>
template<typename T>
inline static void visit_stmt_list(std::list<T*>& 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<SequentialStmt*>* stmts)
: name_(name)
{

View File

@ -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_;