Start to make slots recursive

This commit is contained in:
2020-02-17 14:26:50 +07:00
parent b7df6f66f9
commit 21817b182e
11 changed files with 48 additions and 55 deletions

View File

@ -25,7 +25,7 @@ module SlotMachine
def initialize( source , receiver,arguments )
super(source)
@receiver , @arguments = receiver , arguments
raise "Receiver not Slot #{@receiver}" unless @receiver.is_a?(Slot)
raise "Receiver not Slot #{@receiver}" unless @receiver.is_a?(Slotted)
@arguments.each{|a| raise "args not SlotLoad #{a}" unless a.is_a?(SlotLoad)}
end

View File

@ -33,8 +33,8 @@ module SlotMachine
@left , @right = left , right
@left = Slotted.for(@left.shift , @left) if @left.is_a? Array
@right = Slotted.for(@right.shift , @right) if @right.is_a? Array
raise "right not SlotMachine, #{@right.to_s}" unless @right.is_a?( Slot )
raise "left not SlotMachine, #{@left.to_s}" unless @left.is_a?( Slot )
raise "right not SlotMachine, #{@right.to_s}" unless @right.is_a?( Slotted )
raise "left not SlotMachine, #{@left.to_s}" unless @left.is_a?( Slotted )
@original_source = original_source || self
end

View File

@ -11,7 +11,7 @@ module SlotMachine
def initialize(condition , false_jump)
super(false_jump)
@condition = condition
raise "condition must be slot_definition #{condition}" unless condition.is_a?(Slot)
raise "condition must be slot_definition #{condition}" unless condition.is_a?(Slotted)
end
def to_s