fix slot moves for assignment
This commit is contained in:
parent
66901eeb5b
commit
43d660d2d2
@ -12,7 +12,7 @@ module Vool
|
||||
else
|
||||
type = :frame
|
||||
end
|
||||
Mom::SlotConstant.new(Mom::SlotDefinition.new(:message , [type , @name]) , @value)
|
||||
@value.slot_class.new(Mom::SlotDefinition.new(:message , [type , @name]) , @value)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -11,6 +11,10 @@ module Vool
|
||||
lst = RubyCompiler.compile( "foo = bar")
|
||||
assert_equal :foo , lst.name
|
||||
end
|
||||
def test_local_const
|
||||
lst = RubyCompiler.compile( "foo = 5")
|
||||
assert_equal LocalAssignment , lst.class
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ module Vool
|
||||
end
|
||||
|
||||
def test_class_compiles
|
||||
assert_equal Mom::SlotMove , @first.class , @stats
|
||||
assert_equal Mom::SlotConstant , @first.class , @stats
|
||||
end
|
||||
def test_slot_is_set
|
||||
assert @first.left
|
||||
@ -33,6 +33,19 @@ module Vool
|
||||
end
|
||||
end
|
||||
|
||||
#otherwise as above, but assigning instance, so should get a SlotMove
|
||||
class TestAssignMomInstance < MiniTest::Test
|
||||
include MomCompile
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@stats = compile_first_method( "arg = @a")
|
||||
end
|
||||
|
||||
def test_class_compiles
|
||||
assert_equal Mom::SlotMove , @stats.first.class , @stats
|
||||
end
|
||||
end
|
||||
|
||||
#compiling to an argument should result in different second parameter in the slot array
|
||||
class TestArgMom < MiniTest::Test
|
||||
include MomCompile
|
||||
@ -44,7 +57,7 @@ module Vool
|
||||
end
|
||||
|
||||
def test_class_compiles
|
||||
assert_equal Mom::SlotMove , @first.class , @stats
|
||||
assert_equal Mom::SlotConstant , @first.class , @stats
|
||||
end
|
||||
def test_slot_is_set
|
||||
assert @first.left
|
||||
|
@ -14,7 +14,7 @@ module Vool
|
||||
assert Array != @stats.class , @stats
|
||||
end
|
||||
def test_class_compiles
|
||||
assert_equal Mom::SlotMove , @first.class , @stats
|
||||
assert_equal Mom::SlotConstant , @first.class , @stats
|
||||
end
|
||||
def test_slot_is_set
|
||||
assert @first.left
|
||||
|
Loading…
Reference in New Issue
Block a user