From 72ad8595f2032cfcf73084083306eef909eb42a5 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 3 Oct 2009 13:14:19 +0000 Subject: [PATCH] * parse.y (bv_decls, bvar): fix for block variables. [ruby-dev:39423] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ parse.y | 6 +++--- test/ripper/test_parser_events.rb | 10 ++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07893ce708..efc175dbd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 3 22:14:18 2009 Nobuyoshi Nakada + + * parse.y (bv_decls, bvar): fix for block variables. + [ruby-dev:39423] + Sat Oct 3 21:19:18 2009 Nobuyoshi Nakada * vm_method.c (rb_add_method_def): no redefinition warning on diff --git a/parse.y b/parse.y index 953eaa7396..07ee4bc08f 100644 --- a/parse.y +++ b/parse.y @@ -3403,7 +3403,7 @@ bv_decls : bvar /*%c%*/ /*%c { - $$ = rb_ary_new2($1); + $$ = rb_ary_new3(1, $1); } %*/ | bv_decls ',' bvar @@ -3417,10 +3417,10 @@ bv_decls : bvar bvar : tIDENTIFIER { - new_bv($1); + new_bv(get_id($1)); /*%%%*/ /*% - $$ = $1; + $$ = get_value($1); %*/ } | f_bad_arg diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 4a4854b28a..80199ecce5 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -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 @@ class TestRipper_ParserEvents < Test::Unit::TestCase 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