/*
 * DeclarationStatement.h
 *
 *  Created on: Dec 9, 2012
 *      Author: attero
 */

#ifndef DECLARATIONSTATEMENT_H_
#define DECLARATIONSTATEMENT_H_

#include "ASTStatement.h"
#include "ASTExpression.h"
#include "ConstantExpression.h"
#include "../ContextManager.h"

/**
 * DeclarationStatement is abstraction of declaration/definition
 * You can declare new variables and functions. And they will be added to
 * your world aka context. And you could use them later.
 */
class DeclarationStatement: public ASTStatement {
public:
	std::string name;
	ContextManager * context_manager;
	std::string name_of_context;
	SenchaObject right_value;
	ASTStatement * body;
	bool is_array;
	ASTExpression *  array_size_expression;
	std::vector<std::string> arguments;
	bool is_function;

	void add_right_value(ASTExpression * right);
	DeclarationStatement(ContextManager * context);
	void add_name(std::string);

	void add_array_size(ASTExpression * size_expression);
	void add_argument(std::string name);
	void add_body(ASTStatement * statement);

	virtual SenchaObject execute();
	virtual SenchaObject evaluate() {
		return right_value;
	}
	virtual ~DeclarationStatement();
};

#endif /* DECLARATIONSTATEMENT_H_ */
