summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--parse.y2
-rw-r--r--test/ruby/test_syntax.rb5
3 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 265cb4049bb..1a0677c7e9b 100644
--- a/ChangeLog
+++ b/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
diff --git a/parse.y b/parse.y
index 098e946abd2..9f9093b0bb0 100644
--- a/parse.y
+++ b/parse.y
@@ -4451,6 +4451,8 @@ f_arglist : '(' f_args rparen
| f_args term
{
$$ = $1;
+ lex_state = EXPR_BEG;
+ command_start = TRUE;
}
;
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index b7928580904..7eef6d60664 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -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