get block resolution to use the extra

block_compiler puts in the extra, that we get out when resolving the type
Thus block args work, though only by assuming direct call
This commit is contained in:
Torsten Ruger
2018-07-17 10:37:33 +03:00
parent 280ea8a8c4
commit ff8b95f21a
7 changed files with 36 additions and 11 deletions

View File

@ -15,6 +15,7 @@ module Arm
end
module ArmHelper
def setup
Parfait.boot!
@machine = Arm::ArmMachine
@binary = FakeBin.new
Risc::Position.clear_positions

View File

@ -39,7 +39,7 @@ module Vool
assert_equal 1, @block.frame_type.variable_index(:local)
end
end
class TestBlockMethod #< MiniTest::Test
class TestBlockMethod < MiniTest::Test
include MomCompile
def setup
Parfait.boot!

View File

@ -19,6 +19,9 @@ module Risc
def test_get_new_left_0
assert_equal RegisterValue , @r0.get_new_left(:caller , @compiler).class
end
def test_get_new_left_no_extra
assert @r0.get_new_left(:caller , @compiler).extra.empty?
end
def test_get_new_left_0_reg
assert_equal :r1 , @r0.get_new_left(:caller , @compiler).symbol
end
@ -28,5 +31,10 @@ module Risc
def test_get_new_left_1_reg
assert_equal :r1 , @r0.get_new_left(:caller , @compiler).symbol
end
def test_get_left_uses_extra
@r1 = RegisterValue.new(:r1 , :Space , type_arguments: @r0.type)
# works with nil as compiler, because extra is used
assert_equal :Message , @r1.get_new_left(:arguments , nil).type.class_name
end
end
end

View File

@ -6,7 +6,7 @@ module Risc
def resolve_type(name)
Parfait.object_space.types.values.first
end
def use_reg(type)
def use_reg(type , extra = {})
RegisterValue.new(:r1 , type)
end
def reset_regs