Implemented variable scopes

This commit is contained in:
2024-07-15 16:51:36 +02:00
parent 948d499231
commit 24d3e8f2be
13 changed files with 81 additions and 26 deletions

View File

@ -13,9 +13,9 @@ func (f *Function) ExecuteLeaf(operation token.Token, register cpu.Register, ope
switch operand.Kind {
case token.Identifier:
name := operand.Text()
variable, exists := f.variables[name]
variable := f.Variable(name)
if !exists {
if variable == nil {
return errors.New(&errors.UnknownIdentifier{Name: name}, f.File, operand.Position)
}