Refactored code structure

This commit is contained in:
Eduard Urbach 2024-07-03 11:39:24 +02:00
parent 9e52e2dd1c
commit fd6e874b44
Signed by: eduard
GPG key ID: 49226B848C78F6C8
54 changed files with 583 additions and 450 deletions

View file

@ -1,16 +0,0 @@
package build
import (
"fmt"
"git.akyoto.dev/cli/q/src/build/ast"
)
// CompileLoop compiles a loop instruction.
func (f *Function) CompileLoop(loop *ast.Loop) error {
label := fmt.Sprintf("%s_loop_%d", f.Name, f.count.loop)
f.assembler.Label(label)
defer f.assembler.Jump(label)
f.count.loop++
return f.CompileAST(loop.Body)
}