[macruby-changes] [2605] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 22 01:10:26 PDT 2009


Revision: 2605
          http://trac.macosforge.org/projects/ruby/changeset/2605
Author:   vincent.isambart at gmail.com
Date:     2009-09-22 01:10:24 -0700 (Tue, 22 Sep 2009)
Log Message:
-----------
This should fix the bug #343 (a problem with for loops)

I also added .rbo files to .gitignore.

Modified Paths:
--------------
    MacRuby/trunk/.gitignore
    MacRuby/trunk/compiler.cpp
    MacRuby/trunk/test_vm/loop.rb

Modified: MacRuby/trunk/.gitignore
===================================================================
--- MacRuby/trunk/.gitignore	2009-09-22 05:55:23 UTC (rev 2604)
+++ MacRuby/trunk/.gitignore	2009-09-22 08:10:24 UTC (rev 2605)
@@ -1,3 +1,4 @@
+*.rbo
 *.[oa]
 *.dylib
 .ext

Modified: MacRuby/trunk/compiler.cpp
===================================================================
--- MacRuby/trunk/compiler.cpp	2009-09-22 05:55:23 UTC (rev 2604)
+++ MacRuby/trunk/compiler.cpp	2009-09-22 08:10:24 UTC (rev 2605)
@@ -4941,7 +4941,15 @@
 		    std::vector<Value *> params;
 
 		    params.push_back(compile_mcache(selEach, false));
+
+		    // the block must not be passed to the code
+		    // that generates the values we loop on
+		    current_block_func = NULL;
+		    current_block_node = NULL;
 		    params.push_back(compile_node(node->nd_iter));
+		    current_block_func = cast<Function>(block);
+		    current_block_node = node->nd_body;
+
 		    params.push_back(compile_sel(selEach));
 		    params.push_back(compile_block_create(NULL));
 		    params.push_back(ConstantInt::get(Type::Int8Ty, 0));

Modified: MacRuby/trunk/test_vm/loop.rb
===================================================================
--- MacRuby/trunk/test_vm/loop.rb	2009-09-22 05:55:23 UTC (rev 2604)
+++ MacRuby/trunk/test_vm/loop.rb	2009-09-22 08:10:24 UTC (rev 2605)
@@ -60,3 +60,11 @@
     p x
   end
 }
+
+assert ':ok', %{
+  a = nil
+  for b in [:a, :b].sort {|x, y| x <=> y}
+    c = nil
+  end
+  p :ok
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090922/da26b2f3/attachment.html>


More information about the macruby-changes mailing list