ruby-changes:3763
From: ko1@a...
Date: Sat, 26 Jan 2008 17:44:57 +0900 (JST)
Subject: [ruby-changes:3763] ko1 - Ruby:r15252 (trunk): * compile.c (iseq_compile_each): validate argument expr of "next"
ko1 2008-01-26 17:44:43 +0900 (Sat, 26 Jan 2008) New Revision: 15252 Modified files: trunk/ChangeLog trunk/bootstraptest/test_syntax.rb trunk/compile.c Log: * compile.c (iseq_compile_each): validate argument expr of "next" statement. * bootstraptest/test_syntax.rb: add a test. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=15252&r2=15251&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15252&r2=15251&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_syntax.rb?r1=15252&r2=15251&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 15251) +++ ChangeLog (revision 15252) @@ -1,3 +1,10 @@ +Sat Jan 26 17:42:23 2008 Koichi Sasada <ko1@a...> + + * compile.c (iseq_compile_each): validate argument expr of "next" + statement. + + * bootstraptest/test_syntax.rb: add a test. + Sat Jan 26 17:22:46 2008 Koichi Sasada <ko1@a...> * compile.c, compile.h: fix to calculate correct stack depth Index: bootstraptest/test_syntax.rb =================================================================== --- bootstraptest/test_syntax.rb (revision 15251) +++ bootstraptest/test_syntax.rb (revision 15252) @@ -758,3 +758,11 @@ end :ok }, '[ruby-dev:32882]' + +assert_equal "1\n2\n", %q{ + i = 0 + while i<2 + i += 1 + next p(i) + end +} Index: compile.c =================================================================== --- compile.c (revision 15251) +++ compile.c (revision 15252) @@ -3044,6 +3044,7 @@ LABEL *splabel = NEW_LABEL(0); debugs("next in while loop\n"); ADD_LABEL(ret, splabel); + COMPILE(ret, "next val/valid syntax?", node->nd_stts); add_ensure_iseq(ret, iseq); ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label); ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->start_label); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/