rubyx/lib/vm/function_call.rb

25 lines
449 B
Ruby
Raw Normal View History

2014-05-03 14:13:44 +02:00
module Vm
# name and args , return
class FunctionCall < Value
2014-05-03 14:13:44 +02:00
def initialize(name , args)
@name = name
@args = args
2014-05-03 14:13:44 +02:00
@function = nil
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|
into.add_code arg.load("r#{index}".to_sym)
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
into.add_code Machine.instance.function_call self
2014-05-03 14:13:44 +02:00
end
end
end