fix all tests again

This commit is contained in:
Torsten Ruger 2015-05-13 12:15:14 +03:00
parent dd41758dea
commit f92e5cf475
6 changed files with 8 additions and 8 deletions

View File

@ -12,7 +12,7 @@ module Builtin
# so it is responsible for initial setup (and relocation)
def __init__ context
function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer)
clazz = Virtual::Space.space.get_or_create_class :Kernel
clazz = Virtual::Machine.instance.space.get_or_create_class :Kernel
method = clazz.resolve_method :main
me = Virtual::Self.new(Virtual::Reference)
code = Virtual::Set.new(Virtual::Self.new(me.type), me)
@ -20,7 +20,7 @@ module Builtin
function.add_code Virtual::MethodCall.new(method)
return function
end
def putstring context
def putstring context
function = Virtual::CompiledMethod.new(:putstring , [] )
return function
ret = Virtual::RegisterMachine.instance.write_stdout(function)

View File

@ -29,7 +29,7 @@ module Builtin
var_name = get_function.args.first
return_to = get_function.return_type
index_function = ::Virtual::Space.space.get_or_create_class(:Object).resolve_method(:index_of)
index_function = ::Virtual::Machine.instance.space.get_or_create_class(:Object).resolve_method(:index_of)
# get_function.push( [me] )
# index = get_function.call( index_function )

View File

@ -73,7 +73,7 @@ module Virtual
def self.compile_string expression , method
value = StringConstant.new(expression.string)
to = Return.new(Reference , value)
Space.space.add_object value
Machine.instance.space.add_object value
method.add_code Set.new( to , value )
to
end

View File

@ -8,8 +8,8 @@ module Virtual
end
r = expression.receiver ? Compiler.compile(expression.receiver, method ) : Self.new()
new_method = CompiledMethod.new(expression.name , args , r )
new_method.class_name = r.is_a?(BootClass) ? r.name : method.class_name
clazz = Space.space.get_or_create_class(new_method.class_name)
new_method.class_name = r.is_a?(Parfait::Class) ? r.name : method.class_name
clazz = Machine.instance.space.get_or_create_class(new_method.class_name)
clazz.add_instance_method new_method
#frame = frame.new_frame

View File

@ -117,7 +117,7 @@ module Virtual
[:get , :set , :puts].each do |f|
obj.add_instance_method Builtin::String.send(f , nil)
end
obj = get_or_create_class :Array
obj = space.get_or_create_class :Array
[:get , :set , :push].each do |f|
obj.add_instance_method Builtin::Array.send(f , nil)
end

View File

@ -26,7 +26,7 @@ module Virtual
else
# note: this is the current view: call internal send, even the method name says else
# but send is "special" and accesses the internal method name and resolves.
kernel = Virtual::Space.space.get_or_create_class(:Kernel)
kernel = Virtual::Machine.instance.space.get_or_create_class(:Kernel)
method = kernel.get_instance_method(:__send)
new_codes << MethodCall.new( method )
raise "unimplemented #{code}"