return compiler, not generated mom
does make the tests more verbose, but the code cleaner
This commit is contained in:
parent
f7dfa1c45e
commit
1a97408e22
@ -28,17 +28,12 @@ module Parfait
|
|||||||
type.create_method( @name , @args_type , @frame_type)
|
type.create_method( @name , @args_type , @frame_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
def compile_to_mom(for_type)
|
def compiler_for(for_type)
|
||||||
typed_method = create_typed_method(for_type)
|
|
||||||
source.to_mom( typed_method )
|
|
||||||
end
|
|
||||||
|
|
||||||
def compile_to_risc(for_type)
|
|
||||||
typed_method = create_typed_method(for_type)
|
typed_method = create_typed_method(for_type)
|
||||||
head = source.to_mom( typed_method )
|
head = source.to_mom( typed_method )
|
||||||
compiler = Risc::MethodCompiler.new( typed_method )
|
compiler = Risc::MethodCompiler.new( typed_method )
|
||||||
compiler.add_mom(head)
|
compiler.add_mom(head)
|
||||||
head # return for testing
|
compiler
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@ module Risc
|
|||||||
when "Interpreter"
|
when "Interpreter"
|
||||||
return Risc::InterpreterPlatform.new
|
return Risc::InterpreterPlatform.new
|
||||||
else
|
else
|
||||||
raise "not recignized platform #{name}"
|
raise "not recognized platform #{name.class}:#{name}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,7 +11,7 @@ module Vool
|
|||||||
def to_mom(clazz)
|
def to_mom(clazz)
|
||||||
@clazz = clazz || raise( "no class in #{self}")
|
@clazz = clazz || raise( "no class in #{self}")
|
||||||
method = @clazz.add_method_for(name , make_arg_type , make_frame , body )
|
method = @clazz.add_method_for(name , make_arg_type , make_frame , body )
|
||||||
method.compile_to_risc(clazz.instance_type)
|
method.compiler_for(clazz.instance_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
def each(&block)
|
def each(&block)
|
||||||
|
Loading…
Reference in New Issue
Block a user