/* * RepeatStatement.cpp * * Created on: Dec 9, 2012 * Author: attero */ #include "RepeatStatement.h" RepeatStatement::RepeatStatement(ASTNode * parent) { this->parent = parent; how_many_times = 0; body = NULL; } RepeatStatement::~RepeatStatement() { delete body; } void RepeatStatement::execute() { execute_quietly(); } void RepeatStatement::add_body(ASTStatement * statement) { body = statement; } void RepeatStatement::execute_quietly() { for(int i = 0; i < how_many_times; i++) { body->execute(); } } std::string RepeatStatement::debug() { return "Repeats!"; } void RepeatStatement::add_iteration_number(SenchaObject so) { if(so.type == SenchaObject::integer_number) { how_many_times = so.integer; } else { how_many_times = 0; } }