Class: NameUnbindInstruction

Inherits:
Instruction show all
Defined in:
lib/instructions/name/name_unbind.rb

Overview

Pops the top :name item, and if it is bound to a name (a local, not a variable) it removes that binding.

needs: 1 :name

pushes: nothing

Instance Attribute Summary

Attributes inherited from Instruction

#context

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

#cleanupObject



21
22
23
# File 'lib/instructions/name/name_unbind.rb', line 21

def cleanup
  @context.unbind_name(@lost_name)
end

#deriveObject



17
18
19
# File 'lib/instructions/name/name_unbind.rb', line 17

def derive
  @lost_name = @arg1.name
end

#preconditions?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/instructions/name/name_unbind.rb', line 9

def preconditions?
  needs :name,1
end

#setupObject



13
14
15
# File 'lib/instructions/name/name_unbind.rb', line 13

def setup
  @arg1 = @context.pop(:name)
end