remove call_site value dependency
Revisit for optimization, now irrelevant
This commit is contained in:
parent
349352faa9
commit
0cf0b35853
@ -2,6 +2,7 @@ module Phisol
|
||||
Compiler.class_eval do
|
||||
|
||||
def on_call statement
|
||||
#puts statement
|
||||
name , arguments , receiver = *statement
|
||||
name = name.to_a.first
|
||||
raise "not inside method " unless @method
|
||||
@ -31,34 +32,12 @@ module Phisol
|
||||
end
|
||||
|
||||
# now we have to resolve the method name (+ receiver) into a callable method
|
||||
method = nil
|
||||
if(me.value)
|
||||
raise "branch should only be optiisation, revit"
|
||||
me = me.value
|
||||
if( me.is_a? Parfait::Class )
|
||||
raise "unimplemented #{code} me is #{me}"
|
||||
elsif( me.is_a? Symbol )
|
||||
# get the function from my class. easy peasy
|
||||
method = Virtual.machine.space.get_class_by_name(:Word).get_instance_method(name)
|
||||
raise "Method not implemented #{me.class}.#{code.name}" unless method
|
||||
@method.source.add_code Virtual::MethodCall.new( method )
|
||||
elsif( me.is_a? Fixnum )
|
||||
method = Virtual.machine.space.get_class_by_name(:Integer).get_instance_method(name)
|
||||
#puts Virtual.machine.space.get_class_by_name(:Integer).method_names.to_a
|
||||
raise "Method not implemented Integer.#{name}" unless method
|
||||
@method.source.add_code Virtual::MethodCall.new( method )
|
||||
else
|
||||
raise "unimplemented: \n#{code} \nfor #{ref.inspect}"
|
||||
end
|
||||
else
|
||||
clazz = Virtual.machine.space.get_class_by_name(me.type)
|
||||
raise "No such class #{me.type}" unless clazz
|
||||
method = clazz.get_instance_method(name)
|
||||
puts Virtual.machine.space.get_class_by_name(:Integer).method_names.to_a
|
||||
raise "Method not implemented Integer.#{name}" unless method
|
||||
@method.source.add_code Virtual::MethodCall.new( method )
|
||||
end
|
||||
raise "Method not implemented #{me.value}.#{name}" unless method
|
||||
clazz = Virtual.machine.space.get_class_by_name(me.type)
|
||||
raise "No such class #{me.type}" unless clazz
|
||||
method = clazz.get_instance_method(name)
|
||||
#puts Virtual.machine.space.get_class_by_name(:Integer).method_names.to_a
|
||||
raise "Method not implemented #{me.type}.#{name}" unless method
|
||||
@method.source.add_code Virtual::MethodCall.new( method )
|
||||
ret = use_reg( method.source.return_type )
|
||||
# the effect of the method is that the NewMessage Return slot will be filled, return it
|
||||
# but move it into a register too
|
||||
|
Loading…
Reference in New Issue
Block a user