Implements variable usage, tweaks and fixes for variable assignment
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
#include "../../ScriptType.hpp"
|
||||
#include "../BoundOperators.hpp"
|
||||
#include "../BoundVariables/BoundVariableKey.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -17,6 +18,7 @@ enum class BoundExpressionKind{
|
||||
LiteralFloat,
|
||||
LiteralString,
|
||||
LiteralBool,
|
||||
Variable,
|
||||
|
||||
Unary,
|
||||
Binary,
|
||||
@@ -129,6 +131,36 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class BoundVariableExpression : public BoundExpression{
|
||||
int _scope;
|
||||
int _id;
|
||||
ScriptType _type;
|
||||
public:
|
||||
BoundVariableExpression(int scope, int id, const ScriptType& type, unsigned int start, unsigned int length)
|
||||
: BoundExpression(start, length, nullptr), _type(type){
|
||||
_scope = scope;
|
||||
_id = id;
|
||||
}
|
||||
|
||||
~BoundVariableExpression() override = default;
|
||||
|
||||
ScriptType* GetType() final{
|
||||
return &_type;
|
||||
};
|
||||
|
||||
BoundExpressionKind GetKind() final{
|
||||
return BoundExpressionKind ::Variable;
|
||||
}
|
||||
|
||||
int GetScope(){
|
||||
return _scope;
|
||||
}
|
||||
|
||||
int GetId(){
|
||||
return _id;
|
||||
}
|
||||
};
|
||||
|
||||
class BoundBinaryExpression : public BoundExpression {
|
||||
BoundExpression* _left;
|
||||
BoundExpression* _right;
|
||||
|
||||
Reference in New Issue
Block a user