blob: a8569bdb2e9cb84387c1bd448945cfb372a303ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
* IfNode.h
*
* Created on: Nov 18, 2012
* Author: attero
*/
#ifndef IFNODE_H_
#define IFNODE_H_
#include "ASTStatement.h"
#include "ASTExpression.h"
class IfNode : public ASTStatement
{
public:
void add_condition(ASTExpression * expression);
void add_body(ASTStatement * statement);
void add_else_block(ASTStatement * statement);
bool is_else;
virtual void execute();
bool evaluate_condition();
ASTNode * condition() { return children[0]; }
ASTNode * then_block() { return children[1]; }
ASTNode * else_block() { return children[2]; }
IfNode(ASTNode * parent);
virtual ~IfNode();
};
#endif /* IFNODE_H_ */
|