/*
 * VariableExpression.cpp
 *
 *  Created on: Dec 17, 2012
 *      Author: att
 */

#include "VariableExpression.h"

VariableExpression::VariableExpression(std::string name, ContextManager * context_manager) {
	this->name = name;
	this->name_of_context = "global";
	this->context_manager = context_manager;
	this->type = "VariableExpression";
}

VariableExpression::~VariableExpression() {
	// Do nothing
}

SenchaObject VariableExpression::evaluate()
{
	auto context = context_manager->get_top();
	SenchaObject result = context->get(name);
	result.name = name;
	return result;
}

SenchaObject  VariableExpression::execute()
{
	SenchaObject result = evaluate();
	return result;
}

