Class: Tataru::Instructions::ReturnInstruction
- Inherits:
-
Tataru::Instruction
- Object
- Tataru::Instruction
- Tataru::Instructions::ReturnInstruction
- Defined in:
- lib/tataru/instructions/return_instruction.rb
Overview
pops the callstack and goes back
Instance Attribute Summary
Attributes inherited from Tataru::Instruction
Instance Method Summary collapse
Methods inherited from Tataru::Instruction
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/tataru/instructions/return_instruction.rb', line 7 def run if memory.call_stack.count.zero? return memory.error = 'At bottom of stack' end memory.program_counter = memory.call_stack.pop end |