Implements assignment binding
This commit is contained in:
@@ -6,13 +6,16 @@
|
||||
|
||||
#include <vector>
|
||||
#include "../BoundExpressions/BoundExpression.hpp"
|
||||
#include "../BoundVariables/BoundVariableKey.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
enum class BoundStatementKind{
|
||||
Bad,
|
||||
Script,
|
||||
Block,
|
||||
Expression,
|
||||
Assignment,
|
||||
};
|
||||
|
||||
class BoundStatement{
|
||||
@@ -21,6 +24,13 @@ public:
|
||||
virtual ~BoundStatement() = default;
|
||||
};
|
||||
|
||||
class BoundBadStatement : public BoundStatement{
|
||||
public:
|
||||
BoundStatementKind GetKind() final{
|
||||
return BoundStatementKind ::Bad;
|
||||
}
|
||||
};
|
||||
|
||||
class BoundBlockStatement : public BoundStatement{
|
||||
vector<BoundStatement*> _statements;
|
||||
public:
|
||||
@@ -72,4 +82,22 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class BoundAssignmentStatement : public BoundStatement{
|
||||
BoundVariableKey* _key;
|
||||
BoundExpression* _expression;
|
||||
public:
|
||||
BoundAssignmentStatement(BoundVariableKey* key, BoundExpression* expression){
|
||||
_key = key;
|
||||
_expression = expression;
|
||||
}
|
||||
~BoundAssignmentStatement() final{
|
||||
delete _key;
|
||||
delete _expression;
|
||||
}
|
||||
|
||||
BoundStatementKind GetKind() final{
|
||||
return BoundStatementKind ::Assignment;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //PORYGONLANG_BOUNDSTATEMENT_HPP
|
||||
|
||||
Reference in New Issue
Block a user