Added call registers
This commit is contained in:
parent
8867845310
commit
9e3112ad52
8 changed files with 53 additions and 44 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue