ruby-changes:13436
From: nobu <ko1@a...>
Date: Sat, 3 Oct 2009 22:14:36 +0900 (JST)
Subject: [ruby-changes:13436] Ruby:r25209 (trunk): * parse.y (bv_decls, bvar): fix for block variables.
nobu 2009-10-03 22:14:19 +0900 (Sat, 03 Oct 2009) New Revision: 25209 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25209 Log: * parse.y (bv_decls, bvar): fix for block variables. [ruby-dev:39423] Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ripper/test_parser_events.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 25208) +++ ChangeLog (revision 25209) @@ -1,3 +1,8 @@ +Sat Oct 3 22:14:18 2009 Nobuyoshi Nakada <nobu@r...> + + * parse.y (bv_decls, bvar): fix for block variables. + [ruby-dev:39423] + Sat Oct 3 21:19:18 2009 Nobuyoshi Nakada <nobu@r...> * vm_method.c (rb_add_method_def): no redefinition warning on Index: parse.y =================================================================== --- parse.y (revision 25208) +++ parse.y (revision 25209) @@ -3403,7 +3403,7 @@ /*%c%*/ /*%c { - $$ = rb_ary_new2($1); + $$ = rb_ary_new3(1, $1); } %*/ | bv_decls ',' bvar @@ -3417,10 +3417,10 @@ bvar : tIDENTIFIER { - new_bv($1); + new_bv(get_id($1)); /*%%%*/ /*% - $$ = $1; + $$ = get_value($1); %*/ } | f_bad_arg Index: test/ripper/test_parser_events.rb =================================================================== --- test/ripper/test_parser_events.rb (revision 25208) +++ test/ripper/test_parser_events.rb (revision 25209) @@ -1,6 +1,7 @@ begin require_relative 'dummyparser' +require_relative '../ruby/envutil' require 'test/unit' class TestRipper_ParserEvents < Test::Unit::TestCase @@ -566,6 +567,15 @@ assert_equal("[fcall(p,[],&block([w],[#{div}]))]", parse("p{|w|w /25 # /\n}"), bug1939) assert_equal("[def(p,[w],bodystmt([#{div}]))]", parse("def p(w)\nw /25 # /\nend"), bug1939) end + + def test_block_variables + assert_equal("[fcall(proc,[],&block([],[void()]))]", parse("proc{|;y|}")) + if defined?(Process::RLIMIT_AS) + assert_in_out_err(["-I#{File.dirname(__FILE__)}", "-rdummyparser"], + 'Process.setrlimit(Process::RLIMIT_AS,102400); puts DummyParser.new("proc{|;y|}").parse', + ["[fcall(proc,[],&block([],[void()]))]"], [], '[ruby-dev:39423]') + end + end end rescue LoadError -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/