make mom:method_compiler a list

Compilers forms alist by Util::CompilerList
Change Collection to use the list instead of array
This commit is contained in:
2019-09-28 12:41:38 +03:00
parent aba42a6836
commit 2eb9364283
16 changed files with 58 additions and 63 deletions

View File

@ -37,15 +37,14 @@ module VoolCompile
input = get_preload(preload) + as_main( input )
collection = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)
assert collection.is_a?(Mom::MomCollection) , collection.class.name
compiler = collection.compilers.find{|comp| comp.callable.name == :main}
assert compiler.is_a?(Mom::MethodCompiler)
compiler = collection.compilers.find_compiler{|comp| comp.callable.name == :main}
assert_equal Mom::MethodCompiler , compiler.class
compiler
end
def compile_main_block( block_input , method_input = "main_local = 5" , preload = nil)
source = get_preload(preload) + as_main("#{method_input} ; self.main{|val| #{block_input}}")
mom_col = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom( source )
compiler = mom_col.method_compilers.find{|c| c.get_method.name.to_s.start_with?("main") }
compiler = mom_col.method_compilers.find_compiler{|c| c.get_method.name.to_s.start_with?("main") }
block = compiler.block_compilers.first
assert block
block.mom_instructions.next