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

@ -19,6 +19,7 @@ module Risc
# call build with a block to build
def initialize(compiler, for_source)
raise "no compiler" unless compiler
raise "no source" unless for_source
@compiler = compiler
@source = for_source
@source_used = false
@ -207,7 +208,7 @@ module Risc
def call_get_more
factory = Parfait.object_space.get_factory_for( :Integer )
calling = factory.get_type.get_method( :get_more )
calling = Parfait.object_space.get_main #until we actually parse Factory
calling = Parfait.object_space.get_method!(:Space,:main) #until we actually parse Factory
raise "no main defined" unless calling
Mom::MessageSetup.new( calling ).build_with( self )
self.build do

View File

@ -14,6 +14,7 @@ module Risc
# Must pass the callable (method/block)
# Also start instuction, usually a label is mandatory
def initialize( callable , mom_label)
raise "No method" unless callable
@callable = callable
@regs = []
@constants = []