1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Bug #6403: reset states after empty args

* parse.y (f_arglist): should reset lexical states after empty
  argument list with no parenthesis as well as parenthesized list,
  so that reserved name method definition work.  [ruby-dev:45626]
  [Bug #6403]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-05-14 07:28:36 +00:00
parent c80308119b
commit 45f6cdcdd3
3 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,10 @@
Mon May 14 16:28:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (f_arglist): should reset lexical states after empty
argument list with no parenthesis as well as parenthesized list,
so that reserved name method definition work. [ruby-dev:45626]
[Bug #6403]
Mon May 14 00:14:24 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
* enumerator.c (lazy_take_func, lazy_take): multiple calls of

View file

@ -4451,6 +4451,8 @@ f_arglist : '(' f_args rparen
| f_args term
{
$$ = $1;
lex_state = EXPR_BEG;
command_start = TRUE;
}
;

View file

@ -176,6 +176,11 @@ class TestSyntax < Test::Unit::TestCase
assert_valid_syntax("p begin 1.times do 1 end end", __FILE__, bug6419)
end
def test_reserved_method_no_args
bug6403 = '[ruby-dev:45626]'
assert_valid_syntax("def self; :foo; end", __FILE__, bug6403)
end
private
def not_label(x) @result = x; @not_label ||= nil end