Implemented parameter passing for function pointers

This commit is contained in:
2025-03-03 14:32:11 +01:00
parent 751614e7c0
commit df6f7d5a57
8 changed files with 71 additions and 44 deletions

View File

@ -59,14 +59,32 @@ func (f *Function) CompileCall(root *expression.Expression) ([]types.Type, error
return nil, err
}
f.CallSafe(fn, registers)
f.BeforeCall()
f.Label(asm.CALL, value.Label)
f.AfterCall(registers)
return fn.OutputTypes, nil
case *eval.Register:
err := f.ExpressionsToRegisters(parameters, registers, nil, true)
if err != nil {
return nil, err
}
f.BeforeCall()
f.Register(asm.CALL, value.Register)
f.AfterCall(registers)
case *eval.Memory:
err := f.ExpressionsToRegisters(parameters, registers, nil, true)
if err != nil {
return nil, err
}
f.BeforeCall()
f.Memory(asm.CALL, value.Memory)
f.AfterCall(registers)
}
return nil, nil