/*
 * WhileNode.h
 *
 *  Created on: Dec 10, 2012
 *      Author: attero
 */

#ifndef WHILENODE_H_
#define WHILENODE_H_

#include "ASTStatement.h"
#include "ASTExpression.h"

/**
 * WhileNode is a while construct. It evaluates condition and executes
 * body if it's true, when condition turn into false, WhileNode breaks loop.
 */
class WhileNode: public ASTStatement {
public:
	WhileNode(ASTExpression * condition, ASTStatement * body);
	virtual ~WhileNode();
	ASTStatement * body;
	virtual SenchaObject execute();
	virtual SenchaObject evaluate() { return execute(); }
	bool evaluate_condition();

};

#endif /* WHILENODE_H_ */
