generalize get_main and get_init to get_method

to get at those know methods that really
__must__ exists, hence the bang, raise if don't
about to add method missing and raise to the list
This commit is contained in:
2019-09-15 12:58:43 +03:00
parent b36ba42990
commit 7ee57f2b08
12 changed files with 100 additions and 77 deletions

View File

@ -6,8 +6,8 @@ module Risc
def setup
Parfait.boot!(Parfait.default_test_options)
Risc.boot!
init = Parfait.object_space.get_init
@builder = Risc::MethodCompiler.new( init ,Mom::Label.new( "source_name", "return_label")).builder(init)
label = Mom::Label.new( "source_name", "return_label")
@builder = Risc::MethodCompiler.new( FakeCallable.new ,label).builder("source")
@label = Risc.label("source","name")
@start = @builder.compiler.current
end

View File

@ -6,9 +6,9 @@ module Risc
def setup
Parfait.boot!(Parfait.default_test_options)
Risc.boot!
@init = Parfait.object_space.get_init
@compiler = Risc::MethodCompiler.new( @init, Mom::Label.new( "source_name", "return_label") )
@builder = @compiler.builder(@init)
method = FakeCallable.new
@compiler = Risc::MethodCompiler.new( method, Mom::Label.new( "source_name", "return_label") )
@builder = @compiler.builder(method)
end
def test_list
assert_equal :List , @builder.infer_type(:list).class_name

View File

@ -30,11 +30,11 @@ module Risc
assert_equal Position , Position.get(@linker.cpu_init.first).class
end
def test_first_binary_jump
bin = Parfait.object_space.get_init.binary
bin = Parfait.object_space.get_method!(:Object,:__init__).binary
assert_equal 116 , bin.total_byte_length
end
def test_second_binary_first
bin = Parfait.object_space.get_init.binary
bin = Parfait.object_space.get_method!(:Object,:__init__).binary
assert 0 != bin.get_word(0) , "index 0 is 0 #{bin.inspect}"
end
def test_positions_set