use compiler base class for blocks too
can now go to mom level and add test harness still looks overly complicated, but works first block tests at mom level
This commit is contained in:
@ -38,8 +38,16 @@ module MomCompile
|
||||
@method.source.to_mom( compiler )
|
||||
end
|
||||
def compile_first_block( block_input )
|
||||
mom = compile_first_method( "main_local = 5 ; self.main{|val| #{block_input}}")
|
||||
mom.next(4) # ignore local assign (1) and call (3)
|
||||
source = "main_local = 5 ; self.main{|val| #{block_input}}"
|
||||
vool = RubyX::RubyCompiler.compile( as_test_main(source) ).normalize
|
||||
mom_c = vool.to_mom(nil)
|
||||
compiler = mom_c.method_compilers.find{|c| c.get_method.name == :main and c.get_method.self_type.object_class.name == :Test}
|
||||
block = nil
|
||||
vool.each {|b| block = b if b.is_a?(Vool::BlockStatement)}
|
||||
assert block
|
||||
block_c = compiler.block_compilers.first
|
||||
assert block_c
|
||||
block.body.to_mom(block_c)
|
||||
end
|
||||
def compile_mom(input)
|
||||
Risc.boot!
|
||||
|
Reference in New Issue
Block a user