Fixes for creating variable in local scope
This commit is contained in:
@@ -67,12 +67,12 @@ BoundVariable *BoundScope::GetVariable(int scope, int identifier) {
|
||||
}
|
||||
|
||||
VariableAssignment BoundScope::CreateExplicitLocal(int identifier, const ScriptType& type) {
|
||||
auto scope = this->_localScope.at(this->_currentScope);
|
||||
auto scope = this->_localScope.at(this->_currentScope - 1);
|
||||
if (scope -> find(identifier) != scope -> end()){
|
||||
return VariableAssignment(VariableAssignmentResult::ExplicitLocalVariableExists, nullptr);
|
||||
}
|
||||
scope -> insert({identifier, new BoundVariable(type)});
|
||||
return VariableAssignment(VariableAssignmentResult::Ok, new BoundVariableKey(identifier, this->_currentScope, true));
|
||||
return VariableAssignment(VariableAssignmentResult::Ok, new BoundVariableKey(identifier, this->_currentScope - 1, true));
|
||||
}
|
||||
|
||||
VariableAssignment BoundScope::AssignVariable(int identifier, const ScriptType& type) {
|
||||
|
||||
Reference in New Issue
Block a user