extract base class from method_compiler
to be used for blocks too
This commit is contained in:
@ -4,25 +4,16 @@ module Risc
|
||||
# and to instantiate the methods correctly. Most of the init is typed layer stuff,
|
||||
# but there is some logic too.
|
||||
|
||||
# - risc_instructions: The sequence of risc level instructions that mom was compiled to
|
||||
# - cpu_instructions: The sequence of cpu specific instructions that the
|
||||
# risc_instructions was compiled to
|
||||
# Instructions derive from class Instruction and form a linked list
|
||||
|
||||
class MethodCompiler
|
||||
class MethodCompiler < CallableCompiler
|
||||
|
||||
def initialize( method )
|
||||
@regs = []
|
||||
@method = method
|
||||
name = "#{method.self_type.name}.#{method.name}"
|
||||
@risc_instructions = Risc.label(name, name)
|
||||
@risc_instructions << Risc.label( name, "unreachable")
|
||||
@current = @risc_instructions
|
||||
@constants = []
|
||||
@block_compilers = []
|
||||
super()
|
||||
end
|
||||
attr_reader :risc_instructions , :constants
|
||||
|
||||
def source_name
|
||||
"#{@method.self_type.name}.#{@method.name}"
|
||||
end
|
||||
def get_method
|
||||
@method
|
||||
end
|
||||
|
Reference in New Issue
Block a user