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

31 lines
781 B
C++

/*
* RepeatStatement.h
*
* Created on: Dec 9, 2012
* Author: attero
*/
#ifndef REPEATSTATEMENT_H_
#define REPEATSTATEMENT_H_
#include "ASTStatement.h"
#include "ASTExpression.h"
/**
* Repeat statement if very useful, when you need to do something n-times
* you just repeat(n) {block_of_code}
* It stores how many times it should be executed
* and what should be executed, that is body.
*/
class RepeatStatement: public ASTStatement {
public:
RepeatStatement(ASTExpression * expr, ASTStatement * statement);
ASTStatement * body;
ASTExpression * how_many_times_expr;
virtual SenchaObject execute();
virtual SenchaObject evaluate() { return execute(); }
void add_body(ASTStatement * statement);
virtual ~RepeatStatement();
};
#endif /* REPEATSTATEMENT_H_ */