Blang/src/lib/src/Statement/WhileStatement.cpp

48 lines
883 B
C++

#include "WhileStatement.h"
WhileStatement::WhileStatement(Expr *cond, Statement *body, SourceLocation wl):
_whileLoc(wl)
{
_subStmts[COND] = cond;
_subStmts[BODY] = body;
}
Expr *WhileStatement::getCond()
{
return reinterpret_cast<Expr *>(_subStmts.at(COND));
}
const Expr *WhileStatement::getCond() const
{
return reinterpret_cast<Expr *>(_subStmts.at(COND));
}
void WhileStatement::setCond(Expr *e)
{
_subStmts[COND] = reinterpret_cast<Statement *>(e);
}
Statement *WhileStatement::getBody()
{
return _subStmts.at(BODY);
}
const Statement *WhileStatement::getBody() const
{
return _subStmts.at(BODY);
}
void WhileStatement::setBody(Statement *s)
{
_subStmts[BODY] = s;
}
SourceLocation WhileStatement::getWhileLocation() const
{
return _whileLoc;
}
void WhileStatement::setWhileLocation(SourceLocation loc)
{
_whileLoc = loc;
}