sencha-lang/Sencha-lang/AST/VariableExpression.cpp

42 lines
739 B
C++

/*
* 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;
}
std::string VariableExpression::debug()
{
std::string debug_note = "variable: " + name;
return debug_note;
}
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();
}