Improved code generation

This commit is contained in:
2024-07-09 17:00:04 +02:00
parent 1204591cdc
commit 4386392844
23 changed files with 201 additions and 95 deletions

View File

@ -46,9 +46,9 @@ func NewFunction(name string, file *fs.File, body token.List) *Function {
// Compile turns a function into machine code.
func (f *Function) Compile() {
defer close(f.finished)
f.assembler.Label(asm.LABEL, f.Name)
f.AddLabel(f.Name)
f.err = f.CompileTokens(f.Body)
f.assembler.Return()
f.Return()
}
// CompileTokens compiles a token list.