Sha256: cad2a8ca067f1dd570b921a1a194af446a84c227757ca6a9693518344f05bb95

Contents?: true

Size: 352 Bytes

Versions: 1

Compression:

Stored size: 352 Bytes

Contents

# frozen_string_literal: true

module Tataru
  module Instructions
    # pops the callstack and goes back
    class ReturnInstruction < Instruction
      def run
        if memory.call_stack.count.zero?
          return memory.error = 'At bottom of stack'
        end

        memory.program_counter = memory.call_stack.pop
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tataru-0.2.0 lib/tataru/instructions/return_instruction.rb