blob: b8dc1bf9fbb4c89b873fcd532f51a88ac84ce01d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*
* BasicStatement.cpp
*
* Created on: Dec 5, 2012
* Author: attero
*/
#include "BasicStatement.h"
BasicStatement::BasicStatement(ASTNode * parent) {
this->parent = parent;
}
BasicStatement::~BasicStatement() {
for(auto it = children.begin(); it != children.end(); )
{
delete *it;
it = children.erase(it);
}
}
void BasicStatement::add_expression(ASTExpression * expr)
{
children.push_back(expr);
}
std::string BasicStatement::debug()
{
return "Basic statement with expression:\n" + children[0]->debug() + "\n;\n";
}
void BasicStatement::execute()
{
for(auto child: children)
child->execute() ;
}
void BasicStatement::accept(Visitor * visitor)
{
visitor->visit(this);
}
|