[前][次][番号順一覧][スレッド一覧]

ruby-changes:23593

From: nobu <ko1@a...>
Date: Mon, 14 May 2012 16:28:50 +0900 (JST)
Subject: [ruby-changes:23593] nobu:r35644 (trunk): Bug #6403: reset states after empty args

nobu	2012-05-14 16:28:36 +0900 (Mon, 14 May 2012)

  New Revision: 35644

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35644

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ruby/test_syntax.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35643)
+++ ChangeLog	(revision 35644)
@@ -1,3 +1,10 @@
+Mon May 14 16:28:36 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* enumerator.c (lazy_take_func, lazy_take): multiple calls of
Index: parse.y
===================================================================
--- parse.y	(revision 35643)
+++ parse.y	(revision 35644)
@@ -4451,6 +4451,8 @@
 		| f_args term
 		    {
 			$$ = $1;
+			lex_state = EXPR_BEG;
+			command_start = TRUE;
 		    }
 		;
 
Index: test/ruby/test_syntax.rb
===================================================================
--- test/ruby/test_syntax.rb	(revision 35643)
+++ test/ruby/test_syntax.rb	(revision 35644)
@@ -176,6 +176,11 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]