summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST/VariableExpression.cpp
blob: db216635d8d9557885eb0f0d66a86ff114f53305 (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
/*
 * VariableExpression.cpp
 *
 *  Created on: Dec 17, 2012
 *      Author: att
 */

#include "VariableExpression.h"

VariableExpression::VariableExpression(ASTNode * parent, Context * context, std::string name) {

	this->name = name;
	this->parent = parent;
	this->context = context;
	this->type = "VariableExpression";
}

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

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

void  VariableExpression::execute()
{
	std::cout <<  evaluate().repr() << std::endl;
}

void VariableExpression::execute_quietly()
{
	evaluate();
}