Rework evaluation to use shared pointers, fix bugs
This commit is contained in:
@@ -7,18 +7,18 @@
|
||||
#include "../EvalValues/EvalValue.hpp"
|
||||
|
||||
class EvaluationScope {
|
||||
unordered_map<int, EvalValue*>* _scriptScope;
|
||||
vector<unordered_map<int, EvalValue*>> _localScope;
|
||||
unordered_map<int, shared_ptr<EvalValue>>* _scriptScope;
|
||||
vector<unordered_map<int, shared_ptr<EvalValue>>> _localScope;
|
||||
int _currentScope;
|
||||
public:
|
||||
explicit EvaluationScope(unordered_map<int, EvalValue*>* scriptVariables, int deepestScope);
|
||||
~EvaluationScope();
|
||||
explicit EvaluationScope(unordered_map<int, shared_ptr<EvalValue>>* scriptVariables, int deepestScope);
|
||||
~EvaluationScope() = default;
|
||||
|
||||
void CreateVariable(int scope, int id, EvalValue* value);
|
||||
void SetVariable(int scope, int id, EvalValue* value);
|
||||
void CreateVariable(int scope, int id, shared_ptr<EvalValue> value);
|
||||
void SetVariable(int scope, int id, shared_ptr<EvalValue> value);
|
||||
void OuterScope();
|
||||
void InnerScope();
|
||||
EvalValue* GetVariable(int scope, int id);
|
||||
shared_ptr<EvalValue> GetVariable(int scope, int id);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user