Implements variable assignment evaluation

This commit is contained in:
2019-05-29 14:55:03 +02:00
parent 6185f755a4
commit f6cf4d96dd
11 changed files with 104 additions and 8 deletions

View File

@@ -16,6 +16,7 @@ Script::Script() {
_evaluator = new Evaluator(this);
_lastValue = nullptr;
BoundScript = nullptr;
_scriptVariables = new unordered_map<int, EvalValue*>(0);
}
void Script::Evaluate() {
@@ -27,6 +28,8 @@ Script::~Script() {
delete this -> BoundScript;
delete this -> _lastValue;
delete this -> _evaluator;
this->_scriptVariables->clear();
delete this->_scriptVariables;
}
void Script::Parse(string script) {
@@ -43,7 +46,7 @@ void Script::Parse(string script) {
auto bindScope = new BoundScope(&scriptScope);
this->BoundScript = Binder::Bind(this, parseResult, bindScope);
for (const auto& v : scriptScope){
this->_scopeVariables.insert({v.first, nullptr});
this->_scriptVariables -> insert({v.first, nullptr});
delete v.second;
}
scriptScope.clear();