q/src/build/FunctionCall.go

17 lines
485 B
Go

package build
import "git.akyoto.dev/cli/q/src/build/expression"
// CompileFunctionCall executes a function call.
func (f *Function) CompileFunctionCall(expr *expression.Expression) error {
funcName := expr.Children[0].Token.Text()
parameters := expr.Children[1:]
if funcName == "syscall" {
defer f.assembler.Syscall()
return f.ExpressionsToRegisters(parameters, f.cpu.Syscall)
}
defer f.assembler.Call(funcName)
return f.ExpressionsToRegisters(parameters, f.cpu.Call)
}