generalize assemblers to use callables
not just methods, they are almost the same anyway
This commit is contained in:
@ -30,7 +30,7 @@ module Risc
|
||||
def produce_instructions
|
||||
assert @expect , "No output given"
|
||||
linker = RubyX::RubyXCompiler.new(as_test_main).ruby_to_risc(:interpreter)
|
||||
compiler = linker.assemblers.find{|c| c.method.name == :main and c.method.self_type.object_class.name == :Test}
|
||||
compiler = linker.assemblers.find{|c| c.callable.name == :main and c.callable.self_type.object_class.name == :Test}
|
||||
compiler.instructions
|
||||
end
|
||||
def check_nil
|
||||
|
@ -14,7 +14,7 @@ module Risc
|
||||
end
|
||||
end
|
||||
def test_one_main
|
||||
mains = @linker.assemblers.find_all{|asm| asm.method.name == :main }
|
||||
mains = @linker.assemblers.find_all{|asm| asm.callable.name == :main }
|
||||
assert_equal 1 , mains.length
|
||||
end
|
||||
def test_assembler_num
|
||||
|
@ -14,7 +14,7 @@ module RubyX
|
||||
assert_equal Risc::Linker , @linker.class
|
||||
end
|
||||
def test_method
|
||||
assert_equal :main , @linker.assemblers.first.method.name
|
||||
assert_equal :main , @linker.assemblers.first.callable.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user