coming together, more and more each day
This commit is contained in:
@ -27,12 +27,13 @@ module Ast
|
||||
args << arg_value
|
||||
end
|
||||
function = Vm::Function.new(name , args )
|
||||
context.program.add_function function
|
||||
|
||||
parent_locals = context.locals
|
||||
parent_function = context.function
|
||||
context.locals = locals
|
||||
context.function = function
|
||||
|
||||
context.program.add_function function
|
||||
into = function.entry
|
||||
block.each do |b|
|
||||
compiled = b.compile(context , into)
|
||||
|
@ -5,14 +5,16 @@ module Ast
|
||||
class FuncallExpression < Expression
|
||||
attr_reader :name, :args
|
||||
def initialize name, args
|
||||
@name , @args = name , args
|
||||
@name , @args = name.to_sym , args
|
||||
end
|
||||
def compile context , into
|
||||
params = args.collect{ |a| a.compile(context, into) }
|
||||
fun = Vm::FunctionCall.new( name , params )
|
||||
fun.load_args into
|
||||
fun.do_call into
|
||||
fun
|
||||
function = context.program.get_or_create_function(name)
|
||||
raise "Forward declaration not implemented (#{name}) #{inspect}" if function == nil
|
||||
call = Vm::FunctionCall.new( name , params , function)
|
||||
call.load_args into
|
||||
call.do_call into
|
||||
call
|
||||
end
|
||||
|
||||
def inspect
|
||||
|
Reference in New Issue
Block a user