adjust test helper to current s-exp situation
also refrain from hacking the compiler by using the constructor
This commit is contained in:
parent
f49b0c7356
commit
f359e78982
@ -1,23 +1,10 @@
|
|||||||
require_relative '../helper'
|
require_relative '../helper'
|
||||||
|
|
||||||
Typed::Compiler.class_eval do
|
|
||||||
def set_main main
|
|
||||||
@clazz = Register.machine.space.get_class_by_name :Object
|
|
||||||
@method = main
|
|
||||||
@current = main.instructions.next
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
module ExpressionHelper
|
module ExpressionHelper
|
||||||
|
|
||||||
def set_main compiler
|
|
||||||
compiler.set_main Register.machine.space.get_main
|
|
||||||
end
|
|
||||||
def check
|
def check
|
||||||
machine = Register.machine
|
Register.machine.boot unless Register.machine.booted
|
||||||
machine.boot unless machine.booted
|
compiler = Typed::Compiler.new Register.machine.space.get_main
|
||||||
compiler = Typed::Compiler.new
|
|
||||||
set_main(compiler)
|
|
||||||
code = Typed.ast_to_code @input
|
code = Typed.ast_to_code @input
|
||||||
produced = compiler.process( code )
|
produced = compiler.process( code )
|
||||||
assert @output , "No output given"
|
assert @output , "No output given"
|
||||||
@ -26,8 +13,8 @@ module ExpressionHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
# test hack to in place change object type
|
# test hack to in place change object type
|
||||||
def add_object_field(name,type)
|
def add_space_field(name,type)
|
||||||
class_type = Register.machine.space.get_class_by_name(:Object).instance_type
|
class_type = Register.machine.space.get_class_by_name(:Space).instance_type
|
||||||
class_type.send(:private_add_instance_variable, name , type)
|
class_type.send(:private_add_instance_variable, name , type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user