Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 45f6cdcdd3d11de1bf7691f732bc967880b4caad 1 parent c803081
@nobu nobu authored
Showing with 14 additions and 0 deletions.
  1. +7 −0 ChangeLog
  2. +2 −0  parse.y
  3. +5 −0 test/ruby/test_syntax.rb
View
7 ChangeLog
@@ -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
2  parse.y
@@ -4451,6 +4451,8 @@ f_arglist : '(' f_args rparen
| f_args term
{
$$ = $1;
+ lex_state = EXPR_BEG;
+ command_start = TRUE;
}
;
View
5 test/ruby/test_syntax.rb
@@ -176,6 +176,11 @@ def test_do_block_in_cmdarg_begin
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
Please sign in to comment.
Something went wrong with that request. Please try again.