Rework function evaluation scope to handle tables
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-12 17:56:47 +02:00
parent c022c91777
commit 3477ddd18c
7 changed files with 57 additions and 30 deletions

View File

@@ -37,12 +37,15 @@ shared_ptr<EvalValue> EvaluationScope::GetVariable(int scope, int id) {
return _localScope[scope - 1]->at(id);
}
EvaluationScope* EvaluationScope::CreateBranchingScope(int index){
EvaluationScope* EvaluationScope::CreateBranchingScope(int scopeIndex){
auto scope = new EvaluationScope(this -> _scriptScope, this -> _localScope.size());
for (int i = 0; i < index; i++){
for (int i = 0; i <= scopeIndex; i++){
scope->_localScope[i] = this->_localScope[i];
}
scope->_currentScope = index;
for (int i = scopeIndex + 1; i < _localScope.size(); i++){
scope->_localScope[i] = make_shared<unordered_map<int, shared_ptr<EvalValue>>>();
}
scope->_currentScope = this -> _currentScope;
return scope;
}