Jump to specific function scope when calling function
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-08 16:44:47 +02:00
parent d385a9e3ee
commit 4d452b33e0
5 changed files with 28 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ EvaluationScope::EvaluationScope(unordered_map<int, shared_ptr<EvalValue>> *scri
_currentScope = -1;
}
void EvaluationScope::CreateVariable(int scope, int id, shared_ptr<EvalValue> value) {
void EvaluationScope::CreateVariable(int scope, int id, const shared_ptr<EvalValue>& value) {
if (scope == 0){
_scriptScope->at(id) = value;
} else{
@@ -16,7 +16,7 @@ void EvaluationScope::CreateVariable(int scope, int id, shared_ptr<EvalValue> va
}
}
void EvaluationScope::SetVariable(int scope, int id, shared_ptr<EvalValue> value) {
void EvaluationScope::SetVariable(int scope, int id, const shared_ptr<EvalValue>& value) {
if (scope == 0){
_scriptScope->at(id) = value;
} else{
@@ -31,6 +31,10 @@ shared_ptr<EvalValue> EvaluationScope::GetVariable(int scope, int id) {
return _localScope[scope - 1][id];
}
void EvaluationScope::JumpToScope(int index){
_currentScope = index;
}
void EvaluationScope::OuterScope() {
_currentScope++;
}