From 42a840614e30e09ee42fdcd870050d43910d089e Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sun, 8 Jun 2014 00:55:18 +0300 Subject: [PATCH] adding call counter and splitting block after call --- lib/ast/call_site_expression.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ast/call_site_expression.rb b/lib/ast/call_site_expression.rb index f64f5bd0..81b0bf9e 100644 --- a/lib/ast/call_site_expression.rb +++ b/lib/ast/call_site_expression.rb @@ -3,7 +3,7 @@ module Ast class CallSiteExpression < Expression # attr_reader :name, :args , :receiver - + @@counter = 0 def 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 call.load_args 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}" function.return_type end