Rework function evaluation scope to handle tables
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user