summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST/BasicStatement.cpp
blob: 88d70c2401f113184fb57388b19b283324896551 (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
/*
 * 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() ;
}