Module: DuplicateInstruction

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#target_stackObject (readonly)

Returns the value of attribute target_stack.



168
169
170
# File 'lib/instructions/infrastructure.rb', line 168

def target_stack
  @target_stack
end

Instance Method Details

#cleanupObject



184
185
186
# File 'lib/instructions/infrastructure.rb', line 184

def cleanup
  pushes @target_stack, @result
end

#deriveObject



181
182
183
# File 'lib/instructions/infrastructure.rb', line 181

def derive
  @result = @arg1.clone
end

#initialize(context, target_stack) ⇒ Object



170
171
172
173
# File 'lib/instructions/infrastructure.rb', line 170

def initialize(context, target_stack)
  @target_stack = target_stack
  super(context)
end

#preconditions?Boolean

Returns:

  • (Boolean)


175
176
177
# File 'lib/instructions/infrastructure.rb', line 175

def preconditions?
  needs @target_stack, 1
end

#setupObject



178
179
180
# File 'lib/instructions/infrastructure.rb', line 178

def setup
  @arg1 = @context.peek(@target_stack)
end