Blang/src/include/Statement/ForStatement.hpp

43 lines
930 B
C++

#ifndef FORSTATEMENT_HPP
#define FORSTATEMENT_HPP
#include "Statement.hpp"
#include "SourceLocation.hpp"
#include "AssignStatement.hpp"
class ForStatement : public Statement
{
public:
ForStatement(SourceLocation forLocation, AssignStatement* init, Expr* cond, Statement* body, Expr* inc = NULL);
AssignStatement *getInit();
const AssignStatement *getInit() const;
void setInit(AssignStatement *);
Expr *getCond();
const Expr *getCond() const;
void setCond(Expr *);
Expr *getInc();
const Expr *getInc() const;
void setInc(Expr *);
Statement *getBody();
const Statement *getBody() const;
void setBody(Statement *);
SourceLocation getForLocation() const;
void setForLocation(SourceLocation);
private:
SourceLocation _forLocation;
enum StmtIdentifier
{
INIT, BODY, COND, INC
};
std::map<StmtIdentifier, Statement*> _subStmts;
};
#endif