Jump to specific function scope when calling function
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:
@@ -188,6 +188,10 @@ shared_ptr<EvalValue> Evaluator::EvaluateFunctionCallExpression(BoundExpression*
|
||||
auto type = std::dynamic_pointer_cast<FunctionScriptType>(function->GetType());
|
||||
auto parameterTypes = type->GetParameterTypes();
|
||||
auto parameterKeys = type->GetParameterKeys();
|
||||
auto scope = type -> GetScopeIndex();
|
||||
auto originalScope = this->_evaluationScope->GetCurrentScope();
|
||||
this->_evaluationScope->JumpToScope(scope);
|
||||
|
||||
for (int i = 0; i < parameterTypes.size() && i < parameterKeys.size() && i < parameters.size(); i++){
|
||||
auto parameter = parameters[i];
|
||||
auto requiredType = parameterTypes.at(i);
|
||||
@@ -198,6 +202,7 @@ shared_ptr<EvalValue> Evaluator::EvaluateFunctionCallExpression(BoundExpression*
|
||||
this->_evaluationScope->CreateVariable(key->GetScopeId(), key->GetIdentifier(), parameter->Clone());
|
||||
}
|
||||
this->EvaluateBlockStatement(function->GetInnerBlock().get());
|
||||
this->_evaluationScope->JumpToScope(originalScope);
|
||||
this->_hasReturned = false;
|
||||
auto r = this -> _returnValue;
|
||||
this -> _returnValue = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user