Move booting to RubyXCompiler init

Also pass the source into the compile method.
This way compiler can be reused for subsequent compile.
Does remove some double boots, but no major time save
This commit is contained in:
Torsten Ruger
2018-09-02 13:57:19 +03:00
parent d73e1526cd
commit 8a81d41d5e
14 changed files with 39 additions and 57 deletions

View File

@ -22,7 +22,7 @@ module MomCompile
include ScopeHelper
def compile_method(input)
statements = RubyX::RubyXCompiler.new(input).ruby_to_vool
statements = RubyX::RubyXCompiler.new.ruby_to_vool(input)
assert statements.is_a?(Vool::ClassStatement)
ret = statements.to_mom(nil)
assert_equal Parfait::Class , statements.clazz.class , statements
@ -50,8 +50,7 @@ module MomCompile
block.body.to_mom(block_c)
end
def compile_mom(input)
Risc.boot!
RubyX::RubyXCompiler.new(input).ruby_to_mom
RubyX::RubyXCompiler.new.ruby_to_mom(input)
end
def check_array( should , is )

View File

@ -7,7 +7,7 @@ module Risc
include ScopeHelper
def setup
@linker = RubyX::RubyXCompiler.new(@string_input).ruby_to_binary( :interpreter)
@linker = RubyX::RubyXCompiler.new.ruby_to_binary(@string_input, :interpreter)
@interpreter = Interpreter.new(@linker)
@interpreter.start_program
end