rubyx/lib/vm/call_site.rb

29 lines
592 B
Ruby
Raw Normal View History

2014-05-03 14:13:44 +02:00
module Vm
# name and args , return
class CallSite < Value
2014-05-03 14:13:44 +02:00
def initialize(name , args , function )
@name = name
@args = args
@function = function
2014-05-03 14:13:44 +02:00
end
attr_reader :function , :args , :name
2014-05-03 14:13:44 +02:00
def load_args into
2014-05-05 08:35:40 +02:00
args.each_with_index do |arg , index|
if arg.is_a? IntegerConstant
Vm::Integer.new(index).load into , arg
else
2014-05-14 21:04:03 +02:00
Vm::Integer.new(index).move( into, arg ) if arg.register != index
end
2014-05-05 08:35:40 +02:00
end
2014-05-03 14:13:44 +02:00
end
2014-05-06 20:36:28 +02:00
def do_call into
CMachine.instance.function_call into , self
2014-05-03 14:13:44 +02:00
end
end
end