Implements binding unary expressions

This commit is contained in:
2019-05-22 12:22:52 +02:00
parent 62e938e039
commit 2cdb9abdb6
5 changed files with 83 additions and 20 deletions

View File

@@ -133,13 +133,13 @@ public:
class BoundBinaryExpression : public BoundExpression {
BoundExpression* _left;
BoundExpression* _right;
BoundBinaryOperator _operator;
BoundBinaryOperation _operation;
public:
BoundBinaryExpression(BoundExpression* left, BoundExpression* right, BoundBinaryOperator op, ScriptType* result)
BoundBinaryExpression(BoundExpression* left, BoundExpression* right, BoundBinaryOperation op, ScriptType* result)
: BoundExpression(left->GetStartPosition(), right->GetEndPosition() - left->GetStartPosition(), result){
_left = left;
_right = right;
_operator = op;
_operation = op;
}
~BoundBinaryExpression() final{
delete _left;
@@ -151,7 +151,24 @@ public:
}
};
class BoundUnaryExpression : public BoundExpression {
BoundExpression* _operand;
BoundUnaryOperation _operation;
public:
BoundUnaryExpression(BoundExpression* operand, BoundUnaryOperation op, ScriptType* result, unsigned int start, unsigned int length)
:BoundExpression(start, length, result){
_operand = operand;
_operation = op;
}
~BoundUnaryExpression() final{
delete _operand;
}
BoundExpressionKind GetKind() final{
return BoundExpressionKind ::Unary;
}
};