Implemented parameters

This commit is contained in:
2024-06-27 10:12:41 +02:00
parent 94151773a5
commit 8e64271f74
6 changed files with 76 additions and 27 deletions

View File

@ -17,7 +17,6 @@ import (
type Function struct {
Name string
File *fs.File
Head token.List
Body token.List
Variables map[string]*Variable
Assembler asm.Assembler
@ -152,7 +151,10 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
return errors.New(&errors.UnknownIdentifier{Name: name}, f.File, t.Position)
}
f.Assembler.RegisterRegister(asm.MOVE, register, variable.Register)
if register != variable.Register {
f.Assembler.RegisterRegister(asm.MOVE, register, variable.Register)
}
return nil
case token.Number: