allow reverse syntax for >> (ie <<)
slot >> reg makes sense, being a slot_to_reg but . . . consistently use of << (as meaning assignment , =) also makes sense allow both and let time tell which makes more sense
This commit is contained in:
parent
41d573d571
commit
c042dd9faa
@ -54,8 +54,7 @@ module Mom
|
|||||||
def get_message_to( builder )
|
def get_message_to( builder )
|
||||||
builder.build do
|
builder.build do
|
||||||
space << Parfait.object_space
|
space << Parfait.object_space
|
||||||
space[:first_message] >> next_message
|
next_message << space[:first_message]
|
||||||
#risc << Risc.slot_to_reg(source + "get next message" , space , :first_message , message)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def nnop
|
def nnop
|
||||||
|
@ -68,6 +68,8 @@ module Risc
|
|||||||
ins = Risc.load_constant("#{load.class} to #{self.type}" , load , self)
|
ins = Risc.load_constant("#{load.class} to #{self.type}" , load , self)
|
||||||
when RiscValue
|
when RiscValue
|
||||||
ins = Risc.transfer("#{load.type} to #{self.type}" , load , self)
|
ins = Risc.transfer("#{load.type} to #{self.type}" , load , self)
|
||||||
|
when RValue
|
||||||
|
load >> self
|
||||||
else
|
else
|
||||||
raise "not implemented"
|
raise "not implemented"
|
||||||
end
|
end
|
||||||
|
@ -35,6 +35,12 @@ module Risc
|
|||||||
assert_equal SlotToReg , built.class
|
assert_equal SlotToReg , built.class
|
||||||
assert_equal :r1 , built.array.symbol
|
assert_equal :r1 , built.array.symbol
|
||||||
end
|
end
|
||||||
|
def test_returns_slot_reverse
|
||||||
|
r2 = RiscValue.new(:r2 , :Message)
|
||||||
|
built = @builder.build{ r2 << space[:first_message] }
|
||||||
|
assert_equal SlotToReg , built.class
|
||||||
|
assert_equal :r1 , built.array.symbol
|
||||||
|
end
|
||||||
def test_reuses_names
|
def test_reuses_names
|
||||||
r1 = RiscValue.new(:r1 , :Space)
|
r1 = RiscValue.new(:r1 , :Space)
|
||||||
built = @builder.build{ space << r1 ; space << r1}
|
built = @builder.build{ space << r1 ; space << r1}
|
||||||
|
Loading…
Reference in New Issue
Block a user