/*
 * ConstantExpression.cpp
 *
 *  Created on: Dec 5, 2012
 *      Author: attero
 */

#include "ConstantExpression.h"

ConstantExpression::ConstantExpression(ASTNode * parent) {
	this->parent = parent;
	value = SenchaObject();
}

ConstantExpression::~ConstantExpression() {
	// TODO Auto-generated destructor stub
}

ConstantExpression::ConstantExpression(ASTNode * parent, SenchaObject value, std::string name)
{
	this->parent = parent;
	this->value = value;
	this->value.name = name;
}

SenchaObject ConstantExpression::evaluate()
{
	return value;
}

void  ConstantExpression::execute()
{
	std::cout <<  evaluate().repr() << std::endl;//Do nothing
}

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


ConstantExpression::ConstantExpression(ASTNode * parent, int number)
{
	this->parent = parent; value = SenchaObject(number);
}

ConstantExpression::ConstantExpression(ASTNode * parent, double number)
{
	this->parent = parent;
	value = SenchaObject(number);
}

ConstantExpression::ConstantExpression(ASTNode * parent, std::string text)
{
	this->parent = parent; value = SenchaObject(text);
}

std::string ConstantExpression::debug() { return "Constant expression:\n" + value.repr() + "\n"; }
