summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST/BasicExpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/AST/BasicExpression.cpp')
-rw-r--r--Sencha-lang/AST/BasicExpression.cpp42
1 files changed, 6 insertions, 36 deletions
diff --git a/Sencha-lang/AST/BasicExpression.cpp b/Sencha-lang/AST/BasicExpression.cpp
index 540dca4..a2fab44 100644
--- a/Sencha-lang/AST/BasicExpression.cpp
+++ b/Sencha-lang/AST/BasicExpression.cpp
@@ -7,41 +7,6 @@
#include "BasicExpression.h"
-void BasicExpression::set_operator(std::string op)
-{
- this->oper = op;
-}
-
-void BasicExpression::set_left_operand(ASTNode * left)
-{
- if(!this->children_set)
- {
- children.push_back(left);
- }
- else
- {
- this->children[0] = left;
- }
-
- if(children.size() == 2)
- children_set = true;
-}
-
-void BasicExpression::set_right_operand(ASTNode * right)
-{
- if(!this->children_set)
- {
- children.push_back(right);
-
- }
- else
- {
- this->children[1] = right;
- }
-
- if(children.size() == 2)
- children_set = true;
-}
void BasicExpression::execute()
{
std::cout << evaluate().repr() << std::endl;
@@ -51,6 +16,7 @@ void BasicExpression::execute_quietly()
{
evaluate();
}
+
SenchaObject BasicExpression::evaluate()
{
//TODO refactor it ;)
@@ -115,8 +81,12 @@ SenchaObject BasicExpression::evaluate()
return so;
}
-BasicExpression::BasicExpression() : children_set(false){
+BasicExpression::BasicExpression(ASTNode * left, ASTNode * right, std::string oper )
+{
this->type= "BasicExpression";
+ this->children.push_back(left);
+ this->children.push_back(right);
+ this->oper = oper;
}
BasicExpression::~BasicExpression() {