[macruby-changes] [2030] MacRuby/branches/experimental/compiler.cpp

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 16 19:45:05 PDT 2009


Revision: 2030
          http://trac.macosforge.org/projects/ruby/changeset/2030
Author:   lsansonetti at apple.com
Date:     2009-07-16 19:45:04 -0700 (Thu, 16 Jul 2009)
Log Message:
-----------
fixed the compilation of return from a higher level block (ex: 1.times { 1.times { return } })

Modified Paths:
--------------
    MacRuby/branches/experimental/compiler.cpp

Modified: MacRuby/branches/experimental/compiler.cpp
===================================================================
--- MacRuby/branches/experimental/compiler.cpp	2009-07-17 01:39:05 UTC (rev 2029)
+++ MacRuby/branches/experimental/compiler.cpp	2009-07-17 02:45:04 UTC (rev 2030)
@@ -4396,7 +4396,7 @@
 		assert(Function::classof(block));
 
 		BasicBlock *return_from_block_bb = NULL;
-		if (return_from_block != -1) {
+		if (!old_current_block && return_from_block != -1) {
 		    // The block we just compiled contains one or more
 		    // return expressions! We need to enclose the dispatcher
 		    // call inside an exception handler, since return-from
@@ -4435,15 +4435,15 @@
 		    caller = compile_dispatch_call(params);
 		}
 
-		if (return_from_block != -1) {
+		if (return_from_block_bb != NULL) {
 		    BasicBlock *old_bb = bb;
 		    bb = return_from_block_bb;
 		    compile_return_from_block_handler(return_from_block);	
 		    rescue_bb = old_rescue_bb;
 		    bb = old_bb;
+		    return_from_block = old_return_from_block;
 		}
 
-		return_from_block = old_return_from_block;
 		current_block_func = old_current_block_func;
 		current_block_node = old_current_block_node;
 		dvars = old_dvars;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090716/599d99d7/attachment.html>


More information about the macruby-changes mailing list