Added call registers
This commit is contained in:
@ -113,7 +113,7 @@ func (f *Function) CompileInstruction(line token.List) error {
|
||||
}
|
||||
|
||||
if isFunctionCall(expr) {
|
||||
return f.CompileFunctionCall(expr)
|
||||
return f.ExecuteFunctionCall(expr)
|
||||
}
|
||||
|
||||
return errors.New(&errors.InvalidInstruction{Instruction: expr.Token.Text()}, f.File, expr.Token.Position)
|
||||
@ -139,6 +139,19 @@ func (f *Function) ExpressionToRegister(root *expression.Expression, register cp
|
||||
return f.Execute(operation, register, right)
|
||||
}
|
||||
|
||||
// ExpressionsToRegisters moves multiple expressions into the specified registers.
|
||||
func (f *Function) ExpressionsToRegisters(expressions []*expression.Expression, registers []cpu.Register) error {
|
||||
for i := len(expressions) - 1; i >= 0; i-- {
|
||||
err := f.ExpressionToRegister(expressions[i], registers[i])
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TokenToRegister moves a token into a register.
|
||||
// It only works with identifiers, numbers and strings.
|
||||
func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
|
||||
|
Reference in New Issue
Block a user