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

@ -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
}