Class: NameNextInstruction
- Inherits:
-
Instruction
- Object
- Instruction
- NameNextInstruction
- Defined in:
- lib/instructions/name/name_next.rb
Overview
Creates and pushes a new ReferencePoint onto the :name
stack. The name itself will be a new string, obtained by invoking the context’s Interpreter#next_name method.
needs: nothing
pushes: 1 :name
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
18 19 20 |
# File 'lib/instructions/name/name_next.rb', line 18 def cleanup pushes :exec, @result end |
#derive ⇒ Object
15 16 17 |
# File 'lib/instructions/name/name_next.rb', line 15 def derive @result = ReferencePoint.new(@new_name) end |
#preconditions? ⇒ Boolean
9 10 11 |
# File 'lib/instructions/name/name_next.rb', line 9 def preconditions? true end |
#setup ⇒ Object
12 13 14 |
# File 'lib/instructions/name/name_next.rb', line 12 def setup @new_name = @context.next_name end |