Blang/src/include/Statement/IfStatement.hpp

49 lines
1.0 KiB
C++

#ifndef IFSTATEMENT_HPP
#define IFSTATEMENT_HPP
#include <map>
#include "Statement.hpp"
#include "Expr.hpp"
#include "SourceLocation.hpp"
class IfStatement : public Statement
{
public:
IfStatement(SourceLocation IfLocation, Expr* cond, Statement* then, SourceLocation EL = SourceLocation(), Statement* elses);
ExprStatement* getCond();
const ExprStatement *getCond() const;
void setCond(ExprStatement *);
Statement *getThen();
const Statement *getThen() const;
void setThen(Statement *);
Statement *getElse();
const Statement *getElse() const;
void setElse(Statement *);
SourceLocation getIfLocation() const;
void setIfLocation(SourceLocation);
SourceLocation getThenLocation() const;
void setThenLocation(SourceLocation);
SourceLocation getElseLocation() const;
void setElseLocation(SourceLocation);
private:
enum StmtIdentifier
{
COND, THEN, ELSE
};
std::map<StmtIdentifier, Statement*> _subStmts;
SourceLocation _IfLoc;
SourceLocation _ElseLoc;
};
#endif