Move the space instance to the parfait module

A better fit, maybe even a pattern for singletons
This commit is contained in:
Torsten Ruger
2016-12-30 14:10:49 +02:00
parent a00f6be3ba
commit f0350601a7
43 changed files with 85 additions and 85 deletions

View File

@ -4,7 +4,7 @@ module ExpressionHelper
def check
Register.machine.boot unless Register.machine.booted
compiler = Typed::MethodCompiler.new Parfait::Space.object_space.get_main
compiler = Typed::MethodCompiler.new Parfait.object_space.get_main
code = Typed.ast_to_code @input
assert code.to_s , @input
produced = compiler.process( code )
@ -15,7 +15,7 @@ module ExpressionHelper
# test hack to in place change object type
def add_space_field(name,type)
class_type = Parfait::Space.object_space.get_class_by_name(:Space).instance_type
class_type = Parfait.object_space.get_class_by_name(:Space).instance_type
class_type.send(:private_add_instance_variable, name , type)
end
end

View File

@ -16,20 +16,20 @@ module Register
end
def test_call_main_int
Parfait::Space.object_space.get_main.add_argument(:blar , :Integer)
Parfait.object_space.get_main.add_argument(:blar , :Integer)
@input =s(:call,s(:name, :main),s(:arguments , s(:int, 1)))
check
end
def test_call_main_string
Parfait::Space.object_space.get_main.add_argument(:blar , :Word)
Parfait.object_space.get_main.add_argument(:blar , :Word)
@input =s(:call,s(:name, :main),s(:arguments , s(:string, "1") ))
check
end
def test_call_main_op
Parfait::Space.object_space.get_main.add_local(:bar , :Integer)
Parfait::Space.object_space.get_main.add_argument(:blar , :Integer)
Parfait.object_space.get_main.add_local(:bar , :Integer)
Parfait.object_space.get_main.add_argument(:blar , :Integer)
@input =s(:call,s(:name, :main),s(:arguments , s(:name, :bar) ))
check
end

View File

@ -21,12 +21,12 @@ module Register
end
end
def test_local_int
Parfait::Space.object_space.get_main.add_local(:bar , :Integer)
Parfait.object_space.get_main.add_local(:bar , :Integer)
@input = s(:operator_value, :+, s(:name, :bar), s(:int, 3))
check
end
def test_int_local
Parfait::Space.object_space.get_main.add_local(:bar , :Integer)
Parfait.object_space.get_main.add_local(:bar , :Integer)
@input = s(:operator_value, :+, s(:int, 3), s(:name, :bar))
check
end

View File

@ -10,7 +10,7 @@ module Register
end
def test_local
Parfait::Space.object_space.get_main.add_local(:bar , :Integer)
Parfait.object_space.get_main.add_local(:bar , :Integer)
@input = s(:name, :bar)
@output = Register::RegisterValue
check
@ -24,7 +24,7 @@ module Register
end
def test_args
Parfait::Space.object_space.get_main.add_argument(:bar , :Integer)
Parfait.object_space.get_main.add_argument(:bar , :Integer)
@input = s(:name, :bar)
@output = Register::RegisterValue
check