summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST/ConstantExpression.cpp
blob: e913bea4f01476e71d0d393f9f38cc22cc16ebb9 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * 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"; }