Implements binding binary expressions

This commit is contained in:
2019-05-21 22:15:51 +02:00
parent c8183e5405
commit 62e938e039
5 changed files with 135 additions and 4 deletions

View File

@@ -6,6 +6,7 @@
#include <string>
#include "../../ScriptType.hpp"
#include "../BoundOperators.hpp"
using namespace std;
@@ -47,6 +48,9 @@ public:
unsigned int GetLength(){
return _length;
}
unsigned int GetEndPosition(){
return _start + _length - 1;
}
};
class BoundBadExpression : public BoundExpression{
@@ -126,6 +130,27 @@ public:
}
};
class BoundBinaryExpression : public BoundExpression {
BoundExpression* _left;
BoundExpression* _right;
BoundBinaryOperator _operator;
public:
BoundBinaryExpression(BoundExpression* left, BoundExpression* right, BoundBinaryOperator op, ScriptType* result)
: BoundExpression(left->GetStartPosition(), right->GetEndPosition() - left->GetStartPosition(), result){
_left = left;
_right = right;
_operator = op;
}
~BoundBinaryExpression() final{
delete _left;
delete _right;
}
BoundExpressionKind GetKind() final{
return BoundExpressionKind ::Binary;
}
};