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

ruby-changes:44619

From: nobu <ko1@a...>
Date: Thu, 10 Nov 2016 16:47:48 +0900 (JST)
Subject: [ruby-changes:44619] nobu:r56692 (trunk): parse.y: new_attr_op_assign in ripper needs symbol

nobu	2016-11-10 16:47:44 +0900 (Thu, 10 Nov 2016)

  New Revision: 56692

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56692

  Log:
    parse.y: new_attr_op_assign in ripper needs symbol
    
    * parse.y (command_asgn, arg): new_attr_op_assign in ripper
      expects a Symbol VALUE as the operator, not an ID, so convert
      literal IDs to Symbols.  [ruby-core:78069] [Bug #12916]

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 56691)
+++ parse.y	(revision 56692)
@@ -741,6 +741,8 @@ static VALUE parser_heredoc_dedent(struc https://github.com/ruby/ruby/blob/trunk/parse.y#L741
 
 #define FIXME 0
 
+#else
+#define ripper_id2sym(id) id
 #endif /* RIPPER */
 
 #ifndef RIPPER
@@ -1366,7 +1368,7 @@ command_asgn	: lhs '=' command_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1368
 		| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
 		    {
 			value_expr($5);
-			$$ = new_attr_op_assign($1, idCOLON2, $3, $4, $5);
+			$$ = new_attr_op_assign($1, ripper_id2sym(idCOLON2), $3, $4, $5);
 		    }
 		| backref tOP_ASGN command_rhs
 		    {
@@ -2051,7 +2053,7 @@ arg		: lhs '=' arg_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L2053
 		| primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
 		    {
 			value_expr($5);
-			$$ = new_attr_op_assign($1, idCOLON2, $3, $4, $5);
+			$$ = new_attr_op_assign($1, ripper_id2sym(idCOLON2), $3, $4, $5);
 		    }
 		| primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
 		    {

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

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