2012-12-05 19:32:43 +00:00
|
|
|
/*
|
|
|
|
* ConstantExpression.cpp
|
|
|
|
*
|
|
|
|
* Created on: Dec 5, 2012
|
|
|
|
* Author: attero
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ConstantExpression.h"
|
|
|
|
|
2012-12-17 11:47:05 +00:00
|
|
|
ConstantExpression::ConstantExpression(ASTNode * parent) //Constructor which sets value to null SenchaObject.
|
|
|
|
{
|
2012-12-05 22:27:03 +00:00
|
|
|
this->parent = parent;
|
2012-12-05 20:31:06 +00:00
|
|
|
value = SenchaObject();
|
2012-12-22 10:06:55 +00:00
|
|
|
this->type = "ConstantExpression";
|
2012-12-05 19:32:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ConstantExpression::~ConstantExpression() {
|
|
|
|
|
2012-12-07 15:58:27 +00:00
|
|
|
}
|
|
|
|
|
2012-12-21 15:16:39 +00:00
|
|
|
ConstantExpression::ConstantExpression(ASTNode * parent, SenchaObject value) : value(value)
|
2012-12-09 16:42:13 +00:00
|
|
|
{
|
|
|
|
this->parent = parent;
|
2012-12-21 15:16:39 +00:00
|
|
|
this->type = "ConstantExpression";
|
2012-12-09 16:42:13 +00:00
|
|
|
}
|
|
|
|
|
2012-12-06 17:41:16 +00:00
|
|
|
SenchaObject ConstantExpression::evaluate()
|
2012-12-05 20:31:06 +00:00
|
|
|
{
|
|
|
|
return value;
|
|
|
|
}
|
2012-12-06 17:41:16 +00:00
|
|
|
|
2012-12-09 11:57:51 +00:00
|
|
|
void ConstantExpression::execute()
|
|
|
|
{
|
2012-12-17 09:41:48 +00:00
|
|
|
std::cout << evaluate().repr() << std::endl;
|
2012-12-09 11:57:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ConstantExpression::execute_quietly()
|
|
|
|
{
|
|
|
|
evaluate();
|
|
|
|
}
|
|
|
|
|
2012-12-18 20:22:33 +00:00
|
|
|
void ConstantExpression::accept(Visitor * visitor)
|
|
|
|
{
|
|
|
|
visitor->visit(this);
|
|
|
|
}
|
|
|
|
|
2012-12-06 17:41:16 +00:00
|
|
|
ConstantExpression::ConstantExpression(ASTNode * parent, int number)
|
|
|
|
{
|
|
|
|
this->parent = parent; value = SenchaObject(number);
|
2012-12-22 10:06:55 +00:00
|
|
|
this->type = "ConstantExpression";
|
2012-12-06 17:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ConstantExpression::ConstantExpression(ASTNode * parent, double number)
|
|
|
|
{
|
|
|
|
this->parent = parent;
|
2012-12-22 10:06:55 +00:00
|
|
|
this->type = "ConstantExpression";
|
2012-12-06 17:41:16 +00:00
|
|
|
value = SenchaObject(number);
|
|
|
|
}
|
|
|
|
|
|
|
|
ConstantExpression::ConstantExpression(ASTNode * parent, std::string text)
|
|
|
|
{
|
2012-12-22 10:06:55 +00:00
|
|
|
this->type = "ConstantExpression";
|
2012-12-06 17:41:16 +00:00
|
|
|
this->parent = parent; value = SenchaObject(text);
|
|
|
|
}
|