Implemented return values
This commit is contained in:
parent
67b3a3d820
commit
a0edc45e19
7 changed files with 113 additions and 61 deletions
|
@ -66,6 +66,10 @@ func (a *Assembler) Jump(name string) {
|
|||
|
||||
// Return returns back to the caller.
|
||||
func (a *Assembler) Return() {
|
||||
if len(a.Instructions) > 0 && a.Instructions[len(a.Instructions)-1].Mnemonic == RETURN {
|
||||
return
|
||||
}
|
||||
|
||||
a.Instructions = append(a.Instructions, Instruction{Mnemonic: RETURN})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue