Implemented variable scopes

This commit is contained in:
Eduard Urbach 2024-07-15 16:51:36 +02:00
parent 96078f40d8
commit 1bf288b8fd
Signed by: eduard
GPG key ID: 49226B848C78F6C8
13 changed files with 81 additions and 26 deletions

View file

@ -16,8 +16,11 @@ func (f *Function) CompileIf(branch *ast.If) error {
return err
}
f.AddLabel(success)
defer f.AddLabel(fail)
f.count.branch++
return f.CompileAST(branch.Body)
f.AddLabel(success)
f.pushScope()
err = f.CompileAST(branch.Body)
f.popScope()
f.AddLabel(fail)
return err
}