Blang/src/lib/Statement/DoStatement.cpp

60 lines
1.0 KiB
C++

#include "Statement/DoStatement.hpp"
DoStatement::DoStatement(Statement *body, Expr *cond, SourceLocation DL, SourceLocation WL):
_doLoc(DL),
_whileLoc(WL)
{
_subStmts[BODY] = body;
_subStmts[COND] = cond;
}
Expr *DoStatement::getCond()
{
return reinterpret_cast<Expr *>(_subStmts[COND]);
}
const Expr *DoStatement::getCond() const
{
return reinterpret_cast<Expr *>(_subStmts[COND]);
}
void DoStatement::setCond(Expr *e)
{
_subStmts[COND] = reinterpret_cast<Statement *>(e);
}
Statement *DoStatement::getBody()
{
return _subStmts[BODY];
}
const Statement *DoStatement::getBody() const
{
return _subStmts[BODY];
}
void DoStatement::setBody(Statement *s)
{
_subStmts[BODY] = s;
}
SourceLocation DoStatement::getDoLocation() const
{
return _doLoc;
}
void DoStatement::setDoLocation(SourceLocation loc)
{
_doLoc = loc;
}
SourceLocation DoStatement::getWhileLocation() const
{
return _whileLoc;
}
void DoStatement::setWhileLocation(SourceLocation loc)
{
_whileLoc = loc;
}