Implements binding binary expressions
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user