fix all tests again
This commit is contained in:
parent
dd41758dea
commit
f92e5cf475
@ -12,7 +12,7 @@ module Builtin
|
|||||||
# so it is responsible for initial setup (and relocation)
|
# so it is responsible for initial setup (and relocation)
|
||||||
def __init__ context
|
def __init__ context
|
||||||
function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer)
|
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
|
method = clazz.resolve_method :main
|
||||||
me = Virtual::Self.new(Virtual::Reference)
|
me = Virtual::Self.new(Virtual::Reference)
|
||||||
code = Virtual::Set.new(Virtual::Self.new(me.type), me)
|
code = Virtual::Set.new(Virtual::Self.new(me.type), me)
|
||||||
@ -20,7 +20,7 @@ module Builtin
|
|||||||
function.add_code Virtual::MethodCall.new(method)
|
function.add_code Virtual::MethodCall.new(method)
|
||||||
return function
|
return function
|
||||||
end
|
end
|
||||||
def putstring context
|
def putstring context
|
||||||
function = Virtual::CompiledMethod.new(:putstring , [] )
|
function = Virtual::CompiledMethod.new(:putstring , [] )
|
||||||
return function
|
return function
|
||||||
ret = Virtual::RegisterMachine.instance.write_stdout(function)
|
ret = Virtual::RegisterMachine.instance.write_stdout(function)
|
||||||
|
@ -29,7 +29,7 @@ module Builtin
|
|||||||
var_name = get_function.args.first
|
var_name = get_function.args.first
|
||||||
return_to = get_function.return_type
|
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] )
|
# get_function.push( [me] )
|
||||||
# index = get_function.call( index_function )
|
# index = get_function.call( index_function )
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ module Virtual
|
|||||||
def self.compile_string expression , method
|
def self.compile_string expression , method
|
||||||
value = StringConstant.new(expression.string)
|
value = StringConstant.new(expression.string)
|
||||||
to = Return.new(Reference , value)
|
to = Return.new(Reference , value)
|
||||||
Space.space.add_object value
|
Machine.instance.space.add_object value
|
||||||
method.add_code Set.new( to , value )
|
method.add_code Set.new( to , value )
|
||||||
to
|
to
|
||||||
end
|
end
|
||||||
|
@ -8,8 +8,8 @@ module Virtual
|
|||||||
end
|
end
|
||||||
r = expression.receiver ? Compiler.compile(expression.receiver, method ) : Self.new()
|
r = expression.receiver ? Compiler.compile(expression.receiver, method ) : Self.new()
|
||||||
new_method = CompiledMethod.new(expression.name , args , r )
|
new_method = CompiledMethod.new(expression.name , args , r )
|
||||||
new_method.class_name = r.is_a?(BootClass) ? r.name : method.class_name
|
new_method.class_name = r.is_a?(Parfait::Class) ? r.name : method.class_name
|
||||||
clazz = Space.space.get_or_create_class(new_method.class_name)
|
clazz = Machine.instance.space.get_or_create_class(new_method.class_name)
|
||||||
clazz.add_instance_method new_method
|
clazz.add_instance_method new_method
|
||||||
|
|
||||||
#frame = frame.new_frame
|
#frame = frame.new_frame
|
||||||
|
@ -117,7 +117,7 @@ module Virtual
|
|||||||
[:get , :set , :puts].each do |f|
|
[:get , :set , :puts].each do |f|
|
||||||
obj.add_instance_method Builtin::String.send(f , nil)
|
obj.add_instance_method Builtin::String.send(f , nil)
|
||||||
end
|
end
|
||||||
obj = get_or_create_class :Array
|
obj = space.get_or_create_class :Array
|
||||||
[:get , :set , :push].each do |f|
|
[:get , :set , :push].each do |f|
|
||||||
obj.add_instance_method Builtin::Array.send(f , nil)
|
obj.add_instance_method Builtin::Array.send(f , nil)
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,7 @@ module Virtual
|
|||||||
else
|
else
|
||||||
# note: this is the current view: call internal send, even the method name says 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.
|
# 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)
|
method = kernel.get_instance_method(:__send)
|
||||||
new_codes << MethodCall.new( method )
|
new_codes << MethodCall.new( method )
|
||||||
raise "unimplemented #{code}"
|
raise "unimplemented #{code}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user