Sha256: d642abc4318941f1ffb72b0de8bce3408bfd8299435275d2fe1ed83e6f70df04

Contents?: true

Size: 413 Bytes

Versions: 3

Compression:

Stored size: 413 Bytes

Contents

# pops the top item of the +:int+ stack;
# pushes a ValuePoint with the value negated onto the +:int+ stack
#
# *needs:* 1 +:int+
#
# *pushes:* 1 +:int+
#

class IntNegativeInstruction < Instruction
  def preconditions?
    needs :int, 1
  end
  def setup
    @arg1 = @context.pop_value(:int)
  end
  def derive
      @result = ValuePoint.new("int", -@arg1)
  end
  def cleanup
    pushes :int, @result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nudge-0.2.9 lib/instructions/int/int_negative.rb
nudge-0.2.8 lib/instructions/int/int_negative.rb
nudge-0.2.7 lib/instructions/int/int_negative.rb