just renaming

This commit is contained in:
Torsten Ruger
2015-05-16 12:54:11 +03:00
parent 9376b8bc16
commit bee269f7a8
13 changed files with 20 additions and 20 deletions

View File

@ -62,7 +62,7 @@ module Virtual
def self.compile_module expression , method
clazz = Space.space.get_or_create_class name
clazz = Space.space.get_class_by_name name
raise "uups #{clazz}.#{name}" unless clazz
to = Return.new(Reference , clazz )
method.add_code Set.new( to , clazz )

View File

@ -9,7 +9,7 @@ module Virtual
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?(Parfait::Class) ? r.name : method.class_name
clazz = Machine.instance.space.get_or_create_class(new_method.class_name)
clazz = Machine.instance.space.get_class_by_name(new_method.class_name)
clazz.add_instance_method new_method
#frame = frame.new_frame
@ -36,7 +36,7 @@ module Virtual
if expression.receiver.nil?
clazz = context.current_class
else
c = context.object_space.get_or_create_class expression.receiver.name.to_sym
c = context.object_space.get_class_by_name expression.receiver.name.to_sym
clazz = c.meta_class
end

View File

@ -6,7 +6,7 @@ module Virtual
end
def self.compile_class expression , method
clazz = ::Space.space.get_or_create_class expression.name
clazz = ::Space.space.get_class_by_name expression.name
puts "Created class #{clazz.name.inspect}"
expression.expressions.each do |expr|
# check if it's a function definition and add

View File

@ -93,11 +93,11 @@ module Virtual
# very fiddly chicken 'n egg problem. Functions need to be in the right order, and in fact we
# have to define some dummies, just for the other to compile
# TODO: go through the virtual parfait layer and adjust function names to what they really are
obj = @space.get_or_create_class :Object
obj = @space.get_class_by_name :Object
[:index_of , :_get_instance_variable , :_set_instance_variable].each do |f|
obj.add_instance_method Builtin::Object.send(f , nil)
end
obj = @space.get_or_create_class :Kernel
obj = @space.get_class_by_name :Kernel
# create main first, __init__ calls it
@main = Builtin::Kernel.send(:main , @context)
obj.add_instance_method @main
@ -110,15 +110,15 @@ module Virtual
# the point of which is that by the time main executes, all is "normal"
@init = Block.new(:_init_ , nil )
@init.add_code(Register::RegisterMain.new(underscore_init))
obj = @space.get_or_create_class :Integer
obj = @space.get_class_by_name :Integer
[:putint,:fibo].each do |f|
obj.add_instance_method Builtin::Integer.send(f , nil)
end
obj = @space.get_or_create_class :Word
obj = @space.get_class_by_name :Word
[:get , :set , :puts].each do |f|
obj.add_instance_method Builtin::Word.send(f , nil)
end
obj = space.get_or_create_class :Array
obj = space.get_class_by_name :Array
[:get , :set , :push].each do |f|
obj.add_instance_method Builtin::Array.send(f , nil)
end

View File

@ -28,7 +28,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::Machine.instance.space.get_or_create_class(:Kernel)
kernel = Virtual::Machine.instance.space.get_class_by_name(:Kernel)
method = kernel.get_instance_method(:__send)
new_codes << MethodCall.new( method )
raise "unimplemented: \n#{code}"