39 lines
757 B
C++
39 lines
757 B
C++
|
#ifndef IFSTATEMENT_HPP
|
||
|
#define IFSTATEMENT_HPP
|
||
|
|
||
|
#include "Statement.hpp"
|
||
|
#include "ExprStatement.hpp"
|
||
|
#include "SourceLocation.hpp"
|
||
|
|
||
|
|
||
|
class IfStatement: public Statement{
|
||
|
|
||
|
public:
|
||
|
|
||
|
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);
|
||
|
|
||
|
private:
|
||
|
enum { VAR, COND, THEN, ELSE, END_EXPR };
|
||
|
Statement* _subExprs[END_EXPR];
|
||
|
|
||
|
SourceLocation _IfLoc;
|
||
|
SourceLocation _ElseLoc;
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif
|