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:
@@ -80,6 +80,7 @@ BoundStatement *Binder::BindFunctionDeclarationStatement(ParsedStatement *statem
|
||||
auto parameterTypes = vector<shared_ptr<ScriptType>>(parameters.size());
|
||||
auto parameterKeys = vector<shared_ptr<BoundVariableKey>>(parameters.size());
|
||||
|
||||
auto scopeIndex = this->_scope->GetCurrentScope();
|
||||
this->_scope->GoInnerScope();
|
||||
for (int i = 0; i < parameters.size(); i++){
|
||||
auto var = parameters[i];
|
||||
@@ -97,7 +98,7 @@ BoundStatement *Binder::BindFunctionDeclarationStatement(ParsedStatement *statem
|
||||
|
||||
auto identifier = functionStatement->GetIdentifier();
|
||||
auto returnType = make_shared<ScriptType>(TypeClass::Nil);
|
||||
auto type = make_shared<FunctionScriptType>(returnType, parameterTypes, parameterKeys);
|
||||
auto type = make_shared<FunctionScriptType>(returnType, parameterTypes, parameterKeys, scopeIndex);
|
||||
auto assignment = this->_scope->AssignVariable(identifier.GetHash(), type);
|
||||
if (assignment.GetResult() != VariableAssignmentResult::Ok){
|
||||
this -> _scriptData -> Diagnostics -> LogError(DiagnosticCode::CantAssignVariable, statement->GetStartPosition(), statement->GetLength());
|
||||
|
||||
Reference in New Issue
Block a user