summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST/ConstantExpression.cpp
blob: d0ade2e45f33e6e4d0c2b6ac591479609134b1f3 (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
/*
 * ConstantExpression.cpp
 *
 *  Created on: Dec 5, 2012
 *      Author: attero
 */

#include "ConstantExpression.h"

ConstantExpression::ConstantExpression(ASTNode * parent) {
	// TODO Auto-generated constructor stub
	this->parent = parent;
	value = SenchaObject();
}

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

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

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

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"; }