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

@ -10,6 +10,7 @@ module Risc
# - current instruction is where addidion happens
#
class CallableCompiler
include Util::CompilerList
# Must pass the callable (method/block)
# Also start instuction, usually a label is mandatory
@ -18,11 +19,10 @@ module Risc
@callable = callable
@regs = []
@constants = []
@block_compilers = []
@current = @risc_instructions = mom_label.risc_label(self)
reset_regs
end
attr_reader :risc_instructions , :constants , :block_compilers , :callable , :current
attr_reader :risc_instructions , :constants , :callable , :current
def return_label
@risc_instructions.each do |ins|
@ -138,5 +138,12 @@ module Risc
Risc::Assembler.new(@callable , cpu_instructions )
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 )
collection
end
end
end