2014-05-03 14:13:44 +02:00
|
|
|
module Vm
|
|
|
|
|
|
|
|
# name and args , return
|
|
|
|
|
2014-05-13 20:15:02 +02:00
|
|
|
class CallSite < Value
|
2014-05-03 14:13:44 +02:00
|
|
|
|
2014-05-13 20:06:12 +02:00
|
|
|
def initialize(name , args , function )
|
2014-05-13 15:24:19 +02:00
|
|
|
@name = name
|
2014-05-05 09:13:49 +02:00
|
|
|
@args = args
|
2014-05-13 20:06:12 +02:00
|
|
|
@function = function
|
2014-05-03 14:13:44 +02:00
|
|
|
end
|
2014-05-13 15:24:19 +02:00
|
|
|
attr_reader :function , :args , :name
|
2014-05-03 14:13:44 +02:00
|
|
|
|
2014-05-13 15:24:19 +02:00
|
|
|
def load_args into
|
2014-05-05 08:35:40 +02:00
|
|
|
args.each_with_index do |arg , index|
|
2014-05-13 17:21:24 +02:00
|
|
|
puts "load " + arg.inspect
|
2014-05-13 20:06:12 +02:00
|
|
|
arg.load( into , index )
|
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
|
|
|
|
2014-05-13 15:24:19 +02:00
|
|
|
def do_call into
|
2014-05-13 20:06:12 +02:00
|
|
|
into.add_code CMachine.instance.function_call into , self
|
2014-05-03 14:13:44 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|