sencha-lang/Sencha-lang/AST/IfNode.h

33 lines
666 B
C++

/*
* 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 std::string debug();
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_ */