Class: ExecShoveInstruction

Inherits:
Instruction show all
Includes:
ShoveInstruction
Defined in:
lib/instructions/exec/exec_shove.rb

Overview

pops the top items of the :exec and :int stacks; pushes the :exec down “into” the stack, at a level determined by the :int “destination” value.

If the destination value is negative or 0, the item stays on top; if the destination value is greater than or equal to the depth of the stack, the item goes to the bottom; otherwise, the item is inserted farther from the stack’s top as the destination value increases.

note: the destination depth is calculated after the items have been popped

needs: 1 :exec, 1 :int

pushes: 1 :exec (sortof)

Instance Attribute Summary

Attributes included from ShoveInstruction

#target_stack

Attributes inherited from Instruction

#context

Instance Method Summary collapse

Methods included from ShoveInstruction

#cleanup, #derive, #preconditions?, #setup

Methods inherited from Instruction

all_instructions, #cleanup, #derive, #go, inherited, #needs, #preconditions?, #pushes, #setup, to_nudgecode

Constructor Details

#initialize(context) ⇒ ExecShoveInstruction

Returns a new instance of ExecShoveInstruction.



17
18
19
# File 'lib/instructions/exec/exec_shove.rb', line 17

def initialize(context)
  super(context, :exec)
end