Implemented parameter passing for function pointers
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user