Reordered counters

This commit is contained in:
Eduard Urbach 2024-07-16 11:44:10 +02:00
parent 1bf288b8fd
commit c925fe69b3
Signed by: eduard
GPG key ID: 49226B848C78F6C8
4 changed files with 11 additions and 8 deletions

View file

@ -8,6 +8,7 @@ import (
// CompileIf compiles a branch instruction.
func (f *Function) CompileIf(branch *ast.If) error {
f.count.branch++
success := fmt.Sprintf("%s_if_%d_true", f.Name, f.count.branch)
fail := fmt.Sprintf("%s_if_%d_false", f.Name, f.count.branch)
err := f.CompileCondition(branch.Condition, success, fail)
@ -16,7 +17,6 @@ func (f *Function) CompileIf(branch *ast.If) error {
return err
}
f.count.branch++
f.AddLabel(success)
f.pushScope()
err = f.CompileAST(branch.Body)