Class: IntNegativeInstruction
- Inherits:
-
Instruction
- Object
- Instruction
- IntNegativeInstruction
- Defined in:
- lib/instructions/int/int_negative.rb
Overview
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
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
Methods inherited from Instruction
all_instructions, #go, inherited, #initialize, #needs, #pushes, to_nudgecode
Constructor Details
This class inherits a constructor from Instruction
Instance Method Details
#cleanup ⇒ Object
19 20 21 |
# File 'lib/instructions/int/int_negative.rb', line 19 def cleanup pushes :int, @result end |
#derive ⇒ Object
16 17 18 |
# File 'lib/instructions/int/int_negative.rb', line 16 def derive @result = ValuePoint.new("int", -@arg1) end |
#preconditions? ⇒ Boolean
10 11 12 |
# File 'lib/instructions/int/int_negative.rb', line 10 def preconditions? needs :int, 1 end |
#setup ⇒ Object
13 14 15 |
# File 'lib/instructions/int/int_negative.rb', line 13 def setup @arg1 = @context.pop_value(:int) end |