rubyx/lib/risc/method_compiler.rb
Torsten Rüger 15d1c07a1c Remove dead code
some copy paste in creating full mom layer left dome unused (untested) 
code
thanks to code climate stats
2019-08-18 10:19:52 +03:00

34 lines
818 B
Ruby

module Risc
# MethodCompiler is used to generate risc instructions for methods
# and to instantiate the methods correctly.
class MethodCompiler < CallableCompiler
# Methods starts with a Label, both in risc and mom.
# Pass in the callable(method) and the mom label that the method starts with
def initialize( method , mom_label)
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
# sometimes the method is used as source (tb reviewed)
def source
@callable
end
def add_block_compiler(compiler)
@block_compilers << compiler
end
end
end