class Tataru::Instructions::CallInstruction

pushes the callstack and branches

Public Instance Methods

run() click to toggle source
# File lib/tataru/instructions/call_instruction.rb, line 7
def run
  labels = memory.hash[:labels]
  unless labels.key? @param
    memory.error = 'Label not found'
    return
  end

  memory.call_stack.push(memory.program_counter)
  memory.program_counter = labels[@param] - 1
end