propagate constants from block_compiler up

up to method_compiler, where they are collected by mom_compiler
(and included in binary)
This commit is contained in:
Torsten Ruger
2018-08-01 16:27:34 +03:00
parent 81cc109d1e
commit 4b4528abb2
3 changed files with 19 additions and 10 deletions

View File

@ -10,6 +10,11 @@ module Risc
super(method)
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
@ -106,12 +111,6 @@ module Risc
end
end
# add a constant (which get created during compilation and need to be linked)
def add_constant(const)
raise "Must be Parfait #{const}" unless const.is_a?(Parfait::Object)
@constants << const
end
# add a risc instruction after the current (insertion point)
# the added instruction will become the new insertion point
def add_code( instruction )