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

@ -5,11 +5,10 @@ module Risc
include ScopeHelper
def setup
Parfait.boot!
end
def in_test_vool(str)
vool = RubyX::RubyXCompiler.new(in_Test(str)).ruby_to_vool
vool = RubyX::RubyXCompiler.new.ruby_to_vool(in_Test(str))
vool.to_mom(nil)
vool
end
@ -65,7 +64,7 @@ module Risc
assert_equal 2 , method.frame_type.variable_index(:a)
end
def constant_setup(input)
mom = RubyX::RubyXCompiler.new(in_Test(input)).ruby_to_mom
mom = RubyX::RubyXCompiler.new.ruby_to_mom(in_Test(input))
assert_equal Mom::MomCompiler , mom.class
compiler = mom.method_compilers.first
assert_equal MethodCompiler , compiler.class