Sha256: f15704c615074c838a22a929ab9efecc1a0143e69f04f3738e0ed327e2ed6909
Contents?: true
Size: 744 Bytes
Versions: 3
Compression:
Stored size: 744 Bytes
Contents
# pops the top +:name+ item; # pushes a new +:code+ item that has a value equal to the current context binding # # note: if there is no binding, the resulting +:code+ value will be an empty string # # *needs:* 1 +:name+ # # *pushes:* 1 +:code+ # class CodeNameLookupInstruction < Instruction # was Push3 CODE.DEFINITION def preconditions? needs :name, 1 end def setup @the_reference = @context.pop_value(:name) end def derive bound_value = @context.variables[@the_reference] || @context.names[@the_reference] || nil if bound_value != nil @result = ValuePoint.new("code", bound_value.blueprint) else @result = ValuePoint.new("code", "") end end def cleanup pushes :code, @result end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nudge-0.2.9 | lib/instructions/code/code_name_lookup.rb |
nudge-0.2.8 | lib/instructions/code/code_name_lookup.rb |
nudge-0.2.7 | lib/instructions/code/code_name_lookup.rb |