remove method_compiler init method
as init is really just adding a label it is done in the method (thus mixing the levels, “polluting” parfait with risc, but there must be change coming that way anyway)
This commit is contained in:
parent
3bd23cee28
commit
eb7713a9f3
@ -12,7 +12,7 @@ module Risc
|
||||
def compiler_for( type , method_name , arguments , locals = {})
|
||||
frame = Parfait::NamedList.type_for( locals ) #TODO fix locals passing/ using in builtin
|
||||
args = Parfait::NamedList.type_for( arguments )
|
||||
Risc::MethodCompiler.create_method(type , method_name , args, frame ).init_method
|
||||
Risc::MethodCompiler.create_method(type , method_name , args, frame )
|
||||
end
|
||||
|
||||
# Load the value
|
||||
|
@ -9,10 +9,6 @@ module Risc
|
||||
def __init__ context
|
||||
compiler = Risc::MethodCompiler.create_method(:Kernel,:__init__ ,
|
||||
Parfait::NamedList.type_for({}) , Parfait::NamedList.type_for({}))
|
||||
new_start = Risc.label("__init__ start" , "__init__" )
|
||||
compiler.method.set_instructions( new_start)
|
||||
compiler.set_current( new_start ) #thus abandoning standard method setup
|
||||
|
||||
space = Parfait.object_space
|
||||
space_reg = compiler.use_reg(:Space) #Set up the Space as self upon init
|
||||
compiler.add_load_constant("__init__ load Space", space , space_reg)
|
||||
|
@ -16,7 +16,7 @@ module Risc
|
||||
@method = method
|
||||
@type = method.for_type
|
||||
end
|
||||
@current = @method.instructions
|
||||
@current = @method.risc_instructions
|
||||
end
|
||||
attr_reader :type , :method
|
||||
|
||||
@ -41,17 +41,6 @@ module Risc
|
||||
self.new(method)
|
||||
end
|
||||
|
||||
# add method entry and exit code. Mainly save_return for the enter and
|
||||
# message shuffle and FunctionReturn for the return
|
||||
# return self for chaining
|
||||
def init_method
|
||||
source = "_init_method"
|
||||
name = "#{method.for_type.name}.#{method.name}"
|
||||
@current = @method.set_instructions( Risc.label(source, name))
|
||||
@current << Risc.label( source, "unreachable")
|
||||
self
|
||||
end
|
||||
|
||||
def add_known(name)
|
||||
case name
|
||||
when :receiver
|
||||
|
@ -32,7 +32,7 @@ module Vool
|
||||
@clazz.add_method( method )
|
||||
typed_method = method.create_parfait_method(clazz.instance_type)
|
||||
head = @body.to_mom( typed_method )
|
||||
compiler = Risc::MethodCompiler.new( typed_method ).init_method
|
||||
compiler = Risc::MethodCompiler.new( typed_method )
|
||||
compiler.add_mom(head)
|
||||
head # return for testing
|
||||
end
|
||||
|
@ -63,7 +63,7 @@ end
|
||||
|
||||
module CleanCompile
|
||||
def clean_compile(clazz_name , method_name , args , statements)
|
||||
compiler = Vm::MethodCompiler.create_method(clazz_name,method_name,args ).init_method
|
||||
compiler = Vm::MethodCompiler.create_method(clazz_name,method_name,args )
|
||||
compiler.process( Vm.ast_to_code( statements ) )
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user