adding call counter and splitting block after call

This commit is contained in:
Torsten Ruger 2014-06-08 00:55:18 +03:00
parent 0a14cffefb
commit 42a840614e

View File

@ -3,7 +3,7 @@ module Ast
class CallSiteExpression < Expression class CallSiteExpression < Expression
# attr_reader :name, :args , :receiver # attr_reader :name, :args , :receiver
@@counter = 0
def compile context , into def compile context , into
params = args.collect{ |a| a.compile(context, into) } params = args.collect{ |a| a.compile(context, into) }
@ -25,7 +25,9 @@ module Ast
current_function.save_locals(context , into) if current_function current_function.save_locals(context , into) if current_function
call.load_args into call.load_args into
call.do_call into call.do_call into
current_function.restore_locals(context , into) if current_function after = into.new_block("#{into.name}_call#{@@counter+=1}")
into.insert_at after
current_function.restore_locals(context , after) if current_function
puts "compile call #{function.return_type}" puts "compile call #{function.return_type}"
function.return_type function.return_type
end end