pass parfait method to to_mom

previously it was the toll incarnation, and that is almost the same
But for the type of self. This s by definition only known in the
parfait method
And we need it off course for type checking/dispatch
This commit is contained in:
Torsten Ruger
2018-03-16 11:03:29 +05:30
parent 3909bdcc7d
commit ea882f403a
8 changed files with 20 additions and 18 deletions

View File

@ -8,12 +8,10 @@ module Vool
@clazz = clazz
end
# compile to mom instructions. methods themselves do no result in instructions (yet)
# instead the resulting instruction tree is saved into the method object that
# represents the method
# there is no mom equivalent for a method definition, only a vool/parfait one
# Only the source of gets momed, this should never be called
def to_mom( _ )
method = @clazz.get_method( @name )
@body.to_mom(method)
raise "should not be called (call create_objects)"
end
def each(&block)
@ -33,9 +31,10 @@ module Vool
method = Parfait::VoolMethod.new(name , args_type , frame_type , body )
@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
head = @body.to_mom( method )
compiler.add_mom(head)
head # return for testing
end
private