ruby-changes:2835
From: ko1@a...
Date: 19 Dec 2007 18:48:01 +0900
Subject: [ruby-changes:2835] ko1 - Ruby:r14326 (trunk): * compile.c (iseq_compile_each): remove "retry" in block.
ko1 2007-12-19 17:46:49 +0900 (Wed, 19 Dec 2007)
New Revision: 14326
Modified files:
trunk/ChangeLog
trunk/bootstraptest/test_jump.rb
trunk/compile.c
trunk/lib/drb/invokemethod.rb
trunk/sample/drb/darrayc.rb
trunk/sample/test.rb
trunk/test/drb/drbtest.rb
trunk/test/ruby/test_iterator.rb
Log:
* compile.c (iseq_compile_each): remove "retry" in block.
("iter{retry}" cause syntax error)
Currently, "begin; ...; rescue; iter{retry}; end" cause
syntax error too.
* bootstraptest/test_jump.rb: ditto.
* lib/drb/invokemethod.rb: ditto.
* sample/drb/darrayc.rb: ditto.
* sample/test.rb: ditto.
* test/drb/drbtest.rb: ditto.
* test/ruby/test_iterator.rb: ditto.
* sample/test.rb: add a 'test' directory on the SYSTEM test.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_iterator.rb?r1=14326&r2=14325
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/sample/test.rb?r1=14326&r2=14325
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=14326&r2=14325
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_jump.rb?r1=14326&r2=14325
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/drb/drbtest.rb?r1=14326&r2=14325
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14326&r2=14325
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/drb/invokemethod.rb?r1=14326&r2=14325
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/sample/drb/darrayc.rb?r1=14326&r2=14325
Index: ChangeLog
===================================================================
--- ChangeLog (revision 14325)
+++ ChangeLog (revision 14326)
@@ -1,3 +1,24 @@
+Wed Dec 19 17:34:50 2007 Koichi Sasada <ko1@a...>
+
+ * compile.c (iseq_compile_each): remove "retry" in block.
+ ("iter{retry}" cause syntax error)
+ Currently, "begin; ...; rescue; iter{retry}; end" cause
+ syntax error too.
+
+ * bootstraptest/test_jump.rb: ditto.
+
+ * lib/drb/invokemethod.rb: ditto.
+
+ * sample/drb/darrayc.rb: ditto.
+
+ * sample/test.rb: ditto.
+
+ * test/drb/drbtest.rb: ditto.
+
+ * test/ruby/test_iterator.rb: ditto.
+
+ * sample/test.rb: add a 'test' directory on the SYSTEM test.
+
Wed Dec 19 17:12:59 2007 Koichi Sasada <ko1@a...>
* bootstraptest/test_knownbug.rb, test_block.rb:
Index: bootstraptest/test_jump.rb
===================================================================
--- bootstraptest/test_jump.rb (revision 14325)
+++ bootstraptest/test_jump.rb (revision 14326)
@@ -147,15 +147,15 @@
}
}
assert_equal %q{ok}, %q{
- def m a
- yield
- end
-
- i=0
- m(i+=1){
- retry if i<10
- :ok
+begin
+ eval %q{
+ 1.times{
+ retry
+ }
}
+rescue SyntaxError
+ :ok
+end
}
assert_equal %q{3}, %q{
def m
Index: sample/test.rb
===================================================================
--- sample/test.rb (revision 14325)
+++ sample/test.rb (revision 14326)
@@ -916,18 +916,6 @@
test_ok($x.size == 7)
test_ok($x == [1, 2, 3, 4, 5, 6, 7])
-$done = false
-$x = []
-for i in 1 .. 7 # see how retry works in iterator loop
- if i == 4 and not $done
- $done = true
- retry
- end
- $x.push(i)
-end
-test_ok($x.size == 10)
-test_ok($x == [1, 2, 3, 1, 2, 3, 4, 5, 6, 7])
-
# append method to built-in class
class Array
def iter_test1
@@ -1887,7 +1875,7 @@
false
end
-for script in Dir["#{dir}{lib,sample,ext}/**/*.rb"]
+for script in Dir["#{dir}{lib,sample,ext,test}/**/*.rb"]
unless valid_syntax? IO::read(script), script
STDERR.puts script
$bad = true
Index: sample/drb/darrayc.rb
===================================================================
--- sample/drb/darrayc.rb (revision 14325)
+++ sample/drb/darrayc.rb (revision 14326)
@@ -45,15 +45,3 @@
puts count
redo if count == 3
end
-
-puts "# each, retry"
-retried = false
-ro.each do |x|
- puts x
- if x == 4 && !retried
- puts 'retry'
- retried = true
- retry
- end
-end
-
Index: lib/drb/invokemethod.rb
===================================================================
--- lib/drb/invokemethod.rb (revision 14325)
+++ lib/drb/invokemethod.rb (revision 14326)
@@ -20,8 +20,6 @@
end
if jump_error
case jump_error.reason
- when :retry
- retry
when :break
break(jump_error.exit_value)
else
Index: compile.c
===================================================================
--- compile.c (revision 14325)
+++ compile.c (revision 14326)
@@ -3078,8 +3078,7 @@
break;
}
case NODE_RETRY:{
- if (iseq->type == ISEQ_TYPE_BLOCK ||
- iseq->type == ISEQ_TYPE_RESCUE) {
+ if (iseq->type == ISEQ_TYPE_RESCUE) {
ADD_INSN(ret, nd_line(node), putnil);
ADD_INSN1(ret, nd_line(node), throw,
INT2FIX(0x04) /* TAG_RETRY */ );
Index: test/ruby/test_iterator.rb
===================================================================
--- test/ruby/test_iterator.rb (revision 14325)
+++ test/ruby/test_iterator.rb (revision 14326)
@@ -69,7 +69,7 @@
end
end
- # iterator break/redo/next/retry
+ # iterator break/redo/next
def test_break
done = true
loop{
@@ -104,18 +104,6 @@
end
assert_equal(7, $x.size)
assert_equal([1, 2, 3, 4, 5, 6, 7], $x)
-
- $done = false
- $x = []
- for i in 1 .. 7 # see how retry works in iterator loop
- if i == 4 and not $done
- $done = true
- retry
- end
- $x.push(i)
- end
- assert_equal(10, $x.size)
- assert_equal([1, 2, 3, 1, 2, 3, 4, 5, 6, 7], $x)
end
def test_append_method_to_built_in_class
Index: test/drb/drbtest.rb
===================================================================
--- test/drb/drbtest.rb (revision 14325)
+++ test/drb/drbtest.rb (revision 14326)
@@ -305,18 +305,19 @@
assert_equal([1, 2, 'III', 'III', 4, 'five', 6], ary)
end
- def test_04_retry
- retried = false
- ary = []
- @there.each do |x|
- ary.push x
- if x == 4 && !retried
- retried = true
- retry
- end
- end
- assert_equal([1, 2, 'III', 4, 1, 2, 'III', 4, 'five', 6], ary)
- end
+ # retry in block is not supported on ruby 1.9
+ #def test_04_retry
+ # retried = false
+ # ary = []
+ # @there.each do |x|
+ # ary.push x
+ # if x == 4 && !retried
+ # retried = true
+ # retry
+ # end
+ # end
+ # assert_equal([1, 2, 'III', 4, 1, 2, 'III', 4, 'five', 6], ary)
+ #end
def test_05_break
ary = []
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml