Bug #6419: fix cmdarg begin

* parse.y (primary): begin/end block should be isolated from outside.
  [ruby-dev:45631][Bug #6419]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-05-11 05:23:14 +00:00
parent af310963ab
commit 4bbb0f9801
3 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Fri May 11 14:23:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (primary): begin/end block should be isolated from outside.
[ruby-dev:45631][Bug #6419]
Fri May 11 14:09:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/bigdecimal/bigdecimal.c (PUSH): to prevent VALUE from GC,

View File

@ -2684,6 +2684,8 @@ primary : literal
}
| k_begin
{
$<val>1 = cmdarg_stack;
cmdarg_stack = 0;
/*%%%*/
$<num>$ = ruby_sourceline;
/*%
@ -2692,6 +2694,7 @@ primary : literal
bodystmt
k_end
{
cmdarg_stack = $<val>1;
/*%%%*/
if ($3 == NULL) {
$$ = NEW_NIL();

View File

@ -171,6 +171,11 @@ class TestSyntax < Test::Unit::TestCase
assert_valid_syntax("-> (x, y) {}", __FILE__, feature6390)
end
def test_do_block_in_cmdarg_begin
bug6419 = '[ruby-dev:45631]'
assert_valid_syntax("p begin 1.times do 1 end end", __FILE__, bug6419)
end
private
def not_label(x) @result = x; @not_label ||= nil end