Remove separate block_compiler lists

both in mom and risc method complers
alll just compilers now, all linked
Required to move some code down into callable_compiler but all in all quite little. cleaner
This commit is contained in:
2019-09-28 17:24:10 +03:00
parent dcbc3e17be
commit 1e5073200c
9 changed files with 25 additions and 42 deletions

View File

@ -4,7 +4,6 @@ module Risc
# and to instantiate the methods correctly.
class MethodCompiler < CallableCompiler
include Util::CompilerList
# Methods starts with a Label, both in risc and mom.
# Pass in the callable(method) and the mom label that the method starts with
@ -12,11 +11,6 @@ module Risc
super(method , mom_label)
end
#include block_compilers constants
def constants
block_compilers.inject(@constants.dup){|all, compiler| all += compiler.constants}
end
def source_name
"#{@callable.self_type.name}.#{@callable.name}"
end
@ -26,18 +20,5 @@ module Risc
@callable
end
def add_block_compiler(compiler)
@block_compilers << compiler
end
# translate this method, which means the method itself and all blocks inside it
# returns the array (of assemblers) that you pass in as collection
def translate_method( translator , collection)
collection << translate_cpu( translator )
@block_compilers.each do |block_compiler|
collection << block_compiler.translate_cpu(translator)
end
collection
end
end
end