79 lines
1.3 KiB
C++
79 lines
1.3 KiB
C++
#include "IfStatement.h"
|
|
|
|
IfStatement::IfStatement(SourceLocation IfLocation, Expr* cond, Statement* then, SourceLocation ElseLocation, Statement* elses):
|
|
_IfLoc(IfLocation),
|
|
_ElseLoc(ElseLocation)
|
|
{
|
|
_subStmts[COND] = cond;
|
|
_subStmts[THEN] = then;
|
|
|
|
if(elses)
|
|
_subStmts[ELSE] = elses;
|
|
}
|
|
|
|
|
|
Expr* IfStatement::getCond()
|
|
{
|
|
return reinterpret_cast<Expr *>(_subStmts.at(COND));
|
|
}
|
|
|
|
const Expr *IfStatement::getCond() const
|
|
{
|
|
return reinterpret_cast<Expr *>(_subStmts.at(COND));
|
|
}
|
|
|
|
void IfStatement::setCond(Expr *e)
|
|
{
|
|
_subStmts[COND] = reinterpret_cast<Statement *>(e);
|
|
}
|
|
|
|
Statement *IfStatement::getThen()
|
|
{
|
|
return _subStmts.at(THEN);
|
|
}
|
|
|
|
const Statement *IfStatement::getThen() const
|
|
{
|
|
return _subStmts.at(THEN);
|
|
}
|
|
|
|
void IfStatement::setThen(Statement *s)
|
|
{
|
|
_subStmts[THEN] = s;
|
|
}
|
|
|
|
Statement *IfStatement::getElse()
|
|
{
|
|
return _subStmts.at(ELSE);
|
|
}
|
|
|
|
const Statement *IfStatement::getElse() const
|
|
{
|
|
return _subStmts.at(ELSE);
|
|
}
|
|
|
|
void IfStatement::setElse(Statement *s)
|
|
{
|
|
_subStmts[ELSE] = s;
|
|
}
|
|
|
|
SourceLocation IfStatement::getIfLocation() const
|
|
{
|
|
return _IfLoc;
|
|
}
|
|
|
|
void IfStatement::setIfLocation(SourceLocation loc)
|
|
{
|
|
_IfLoc = loc;
|
|
}
|
|
|
|
SourceLocation IfStatement::getThenLocation() const
|
|
{
|
|
return _ElseLoc;
|
|
}
|
|
|
|
void IfStatement::setThenLocation(SourceLocation loc)
|
|
{
|
|
_ElseLoc = loc;
|
|
}
|