Sha256: 780f2858d2bea0df52ef6c488d294527d59d8f37712dbd381ef5daf78bfbeca5

Contents?: true

Size: 499 Bytes

Versions: 3

Compression:

Stored size: 499 Bytes

Contents

# pops the top +:code+ item;
# pushes a new +:bool+ item with value +true+ if the +:code+ is an empty block
#
# *needs:* 1 +:code+
#
# *pushes:* 1 +:bool+
#

class CodeNullQInstruction < Instruction
  def preconditions?
    needs :code, 1
  end
  
  def setup
    arg_blueprint = @context.pop_value(:code)
    @arg1 = NudgeProgram.new(arg_blueprint).blueprint
  end
  
  def derive
    @result = ValuePoint.new("bool", @arg1 == "block {}")
  end
  
  def cleanup
    pushes :bool, @result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nudge-0.2.9 lib/instructions/code/code_null_q.rb
nudge-0.2.8 lib/instructions/code/code_null_q.rb
nudge-0.2.7 lib/instructions/code/code_null_q.rb