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

@ -2,6 +2,8 @@ module Mom
class Init < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
main = Parfait.object_space.get_method!(:Space, :main)
builder.build do
factory! << Parfait.object_space.get_factory_for(:Message)
message << factory[:next_object]
@ -9,7 +11,7 @@ module Mom
factory[:next_object] << next_message
end
builder.reset_names
Mom::MessageSetup.new(Parfait.object_space.get_main).build_with( builder )
Mom::MessageSetup.new(main).build_with( builder )
builder.build do
message << message[:next_message]
@ -22,7 +24,7 @@ module Mom
builder.build do
ret_tmp << exit_label
message[:return_address] << ret_tmp
add_code Risc.function_call( "__init__ issue call" , Parfait.object_space.get_main)
add_code Risc.function_call( "__init__ issue call" , main)
add_code exit_label
end
compiler.reset_regs