2012-12-05 22:27:03 +00:00
|
|
|
/*
|
|
|
|
* BasicStatement.cpp
|
|
|
|
*
|
|
|
|
* Created on: Dec 5, 2012
|
|
|
|
* Author: attero
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "BasicStatement.h"
|
|
|
|
|
|
|
|
BasicStatement::BasicStatement(ASTNode * parent) {
|
|
|
|
this->parent = parent;
|
2012-12-22 10:06:55 +00:00
|
|
|
this->type = "BasicStatement";
|
2012-12-05 22:27:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BasicStatement::~BasicStatement() {
|
2012-12-17 08:37:45 +00:00
|
|
|
for(auto it = children.begin(); it != children.end(); )
|
|
|
|
{
|
|
|
|
delete *it;
|
|
|
|
it = children.erase(it);
|
|
|
|
}
|
2012-12-05 22:27:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BasicStatement::add_expression(ASTExpression * expr)
|
|
|
|
{
|
2012-12-06 17:41:16 +00:00
|
|
|
children.push_back(expr);
|
2012-12-05 22:27:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string BasicStatement::debug()
|
|
|
|
{
|
|
|
|
return "Basic statement with expression:\n" + children[0]->debug() + "\n;\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasicStatement::execute()
|
|
|
|
{
|
2012-12-09 20:17:13 +00:00
|
|
|
for(auto child: children)
|
|
|
|
child->execute() ;
|
2012-12-05 22:27:03 +00:00
|
|
|
}
|
2012-12-18 20:22:33 +00:00
|
|
|
|
|
|
|
void BasicStatement::accept(Visitor * visitor)
|
|
|
|
{
|
|
|
|
visitor->visit(this);
|
|
|
|
}
|