Fix div10 without method_missing

but reanimate infer_type to auto create the needed regsiters
also some helpers
This commit is contained in:
2020-03-04 12:39:52 +02:00
parent 9a5e0f15cd
commit 9c5d17a3bb
6 changed files with 47 additions and 20 deletions

View File

@ -10,6 +10,12 @@ module Risc
@compiler = Risc::MethodCompiler.new( method, SlotMachine::Label.new( "source_name", "return_label") )
@builder = @compiler.builder(method)
end
def test_register_creation
assert_equal RegisterValue , @builder.register(:name).class
end
def test_register_creation_compiler
assert @builder.register(:name).compiler
end
def test_list
assert_equal :List , @builder.infer_type(:list).class_name
end

View File

@ -14,7 +14,7 @@ module SlotMachine
assert_equal Risc::MethodCompiler , @method.to_risc.class
end
def test_risc_length
assert_equal 70 , @method.to_risc.risc_instructions.length
assert_equal 69 , @method.to_risc.risc_instructions.length
end
end
end