Also make risc compilers a linked lists
also via util::compiler_ist leave collection as much in place as possible (though collections and seperate block_compilers are about to go)
This commit is contained in:
@ -13,11 +13,11 @@ module Mom
|
||||
assert_equal Risc::RiscCollection, @risc.class
|
||||
end
|
||||
def test_main_compiler
|
||||
assert_equal :main , @risc.method_compilers.first.callable.name
|
||||
assert_equal :main , @risc.method_compilers.callable.name
|
||||
end
|
||||
def test_main_block_compiler
|
||||
assert_equal :main , @risc.method_compilers.first.block_compilers.first.in_method.name
|
||||
assert_equal :main_block , @risc.method_compilers.first.block_compilers.first.callable.name
|
||||
assert_equal :main , @risc.method_compilers.block_compilers.first.in_method.name
|
||||
assert_equal :main_block , @risc.method_compilers.block_compilers.first.callable.name
|
||||
end
|
||||
end
|
||||
class TestBlockCompiler2 < MiniTest::Test
|
||||
@ -32,11 +32,11 @@ module Mom
|
||||
assert_equal Risc::RiscCollection, @risc.class
|
||||
end
|
||||
def test_main_compiler
|
||||
assert_equal :main , @risc.method_compilers.first.callable.name
|
||||
assert_equal :main , @risc.method_compilers.callable.name
|
||||
end
|
||||
def test_main_block_compiler
|
||||
assert_equal :main , @risc.method_compilers.first.block_compilers.first.in_method.name
|
||||
assert_equal :main_block , @risc.method_compilers.first.block_compilers.first.callable.name
|
||||
assert_equal :main , @risc.method_compilers.block_compilers.first.in_method.name
|
||||
assert_equal :main_block , @risc.method_compilers.block_compilers.first.callable.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -32,14 +32,14 @@ module Mom
|
||||
@collection = @comp.to_risc()
|
||||
end
|
||||
def compiler
|
||||
@collection.method_compilers.first
|
||||
@collection.method_compilers
|
||||
end
|
||||
def test_has_to_risc
|
||||
assert_equal Risc::RiscCollection, @collection.class
|
||||
end
|
||||
def test_has_risc_compiler
|
||||
assert_equal Risc::MethodCompiler, compiler.class
|
||||
assert_equal 3, @collection.method_compilers.length
|
||||
assert_equal 3, @collection.method_compilers.num_compilers
|
||||
end
|
||||
def test_has_risc_instructions
|
||||
assert_equal Risc::Label, compiler.risc_instructions.class
|
||||
|
@ -37,14 +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_compiler{|comp| comp.callable.name == :main}
|
||||
compiler = collection.compilers.find_compiler_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_compiler{|c| c.get_method.name.to_s.start_with?("main") }
|
||||
compiler = mom_col.method_compilers.find_compiler_name(:main)
|
||||
block = compiler.block_compilers.first
|
||||
assert block
|
||||
block.mom_instructions.next
|
||||
|
@ -9,7 +9,7 @@ module Util
|
||||
end
|
||||
end
|
||||
|
||||
class TestComplierListOne < Minitest::Test
|
||||
class TestCompilerListOne < Minitest::Test
|
||||
|
||||
def setup
|
||||
@compiler = MethodCompiler.new(:one)
|
||||
@ -27,7 +27,7 @@ module Util
|
||||
assert_equal :one , @compiler.find_compiler{|c| c.name == :one}.name
|
||||
end
|
||||
end
|
||||
class TestComplierListTwo < Minitest::Test
|
||||
class TestCompilerListTwo < Minitest::Test
|
||||
|
||||
def setup
|
||||
@compiler = MethodCompiler.new(:one)
|
||||
|
@ -21,7 +21,7 @@ module Vool
|
||||
def setup
|
||||
source = "class Integer<Data4;def +(other);X.int_operator(:+);end;end;" + class_main
|
||||
ret = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(source)
|
||||
@ins = ret.compilers.find_compiler{|c|c.callable.name==:main}.mom_instructions.next
|
||||
@ins = ret.compilers.find_compiler_name(:main).mom_instructions.next
|
||||
end
|
||||
def test_array
|
||||
check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,
|
||||
|
@ -20,8 +20,8 @@ module Vool
|
||||
|
||||
def setup
|
||||
ret = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(class_main)
|
||||
@compiler = ret.compilers.find_compiler{|c|c.callable.name==:some_inst}
|
||||
@main = ret.compilers.find_compiler{|c|c.callable.name==:main}
|
||||
@compiler = ret.compilers.find_compiler_name(:some_inst)
|
||||
@main = ret.compilers.find_compiler_name(:main)
|
||||
@ins = @compiler.mom_instructions.next
|
||||
end
|
||||
def test_class_inst
|
||||
|
@ -23,7 +23,7 @@ module Vool
|
||||
def setup
|
||||
source = "class Integer < Data4;def +(other);X.int_operator(:+);end;end;" + class_main
|
||||
ret = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(source)
|
||||
@ins = ret.compilers.find_compiler{|c|c.callable.name==:main}.mom_instructions.next
|
||||
@ins = ret.compilers.find_compiler_name(:main).mom_instructions.next
|
||||
end
|
||||
def test_array
|
||||
check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,
|
||||
|
Reference in New Issue
Block a user