From 860b40fd631f280fbc9164abdc36409dcfac7e27 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 19 Dec 2007 08:46:49 +0000 Subject: * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 21 +++++++++++++++++++++ bootstraptest/test_jump.rb | 16 ++++++++-------- compile.c | 3 +-- lib/drb/invokemethod.rb | 2 -- sample/drb/darrayc.rb | 12 ------------ sample/test.rb | 14 +------------- test/drb/drbtest.rb | 25 +++++++++++++------------ test/ruby/test_iterator.rb | 14 +------------- 8 files changed, 45 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index e979107bfd..f939387948 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Wed Dec 19 17:34:50 2007 Koichi Sasada + + * 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 * bootstraptest/test_knownbug.rb, test_block.rb: diff --git a/bootstraptest/test_jump.rb b/bootstraptest/test_jump.rb index b1a74d889a..bc1a613b56 100644 --- a/bootstraptest/test_jump.rb +++ b/bootstraptest/test_jump.rb @@ -147,15 +147,15 @@ assert_equal %q{131}, %q{ } } 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 diff --git a/compile.c b/compile.c index bd5bfa9954..3c76edd54e 100644 --- a/compile.c +++ b/compile.c @@ -3078,8 +3078,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) 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 */ ); diff --git a/lib/drb/invokemethod.rb b/lib/drb/invokemethod.rb index 412b2ab9b5..7da8ace88d 100644 --- a/lib/drb/invokemethod.rb +++ b/lib/drb/invokemethod.rb @@ -20,8 +20,6 @@ module DRb end if jump_error case jump_error.reason - when :retry - retry when :break break(jump_error.exit_value) else diff --git a/sample/drb/darrayc.rb b/sample/drb/darrayc.rb index 6f5ff6bb5d..b181d22699 100644 --- a/sample/drb/darrayc.rb +++ b/sample/drb/darrayc.rb @@ -45,15 +45,3 @@ ro.each do |x| 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 - diff --git a/sample/test.rb b/sample/test.rb index 4d99a700e4..4cbddabfbf 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -916,18 +916,6 @@ end 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 @@ rescue Exception 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 diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index bc16ab1ca2..d2c96f05c5 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -305,18 +305,19 @@ module DRbAry 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 = [] diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb index 067dd69b80..4b38ac806a 100644 --- a/test/ruby/test_iterator.rb +++ b/test/ruby/test_iterator.rb @@ -69,7 +69,7 @@ class TestIterator < Test::Unit::TestCase end end - # iterator break/redo/next/retry + # iterator break/redo/next def test_break done = true loop{ @@ -104,18 +104,6 @@ class TestIterator < Test::Unit::TestCase 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 -- cgit v1.2.3