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

ruby-changes:40349

From: nobu <ko1@a...>
Date: Tue, 3 Nov 2015 09:27:12 +0900 (JST)
Subject: [ruby-changes:40349] nobu:r52430 (trunk): parse.y: revert lbracket

nobu	2015-11-03 09:27:04 +0900 (Tue, 03 Nov 2015)

  New Revision: 52430

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

  Log:
    parse.y: revert lbracket
    
    * parse.y (lbracket): remove .? before aref.  [Feature #11537]
      revert r52422 and r52424

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ruby/test_call.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52429)
+++ ChangeLog	(revision 52430)
@@ -8,16 +8,6 @@ Tue Nov  3 06:18:21 2015  Eric Wong  <e@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L8
 
 	* variable.c (rb_global_tbl): convert to id_table
 
-Tue Nov  3 01:58:46 2015  Naohisa Goto  <ngotogenome@g...>
-
-	* parse.y (NO_QCALL): fix type mismatch of operands that causes
-	  compile error with Oracle Solaris Studio on Solaris.
-	  [Bug #11645] [ruby-dev:49327]
-
-Mon Nov  2 20:07:10 2015  Nobuyoshi Nakada  <nobu@r...>
-
-	* parse.y (lbracket): support .? before aref.  [Feature #11537]
-
 Sun Nov  1 17:14:36 2015  Koichi Sasada  <ko1@a...>
 
 	* id_table.c (mix_id_table_insert): do not touch list during
Index: parse.y
===================================================================
--- parse.y	(revision 52429)
+++ parse.y	(revision 52430)
@@ -373,9 +373,6 @@ static int parser_yyerror(struct parser_ https://github.com/ruby/ruby/blob/trunk/parse.y#L373
 
 #define NODE_CALL_Q(q) (((q) == tDOTQ) ? NODE_QCALL : NODE_CALL)
 #define NEW_QCALL(q,r,m,a) NEW_NODE(NODE_CALL_Q(q),r,m,a)
-#define NO_QCALL(q, here) \
-	((q) != tDOTQ ? (void)0 : \
-	 (void)yyerror(".? in "here" is not supported yet"))
 
 static int yylex(YYSTYPE*, struct parser_params*);
 
@@ -850,7 +847,7 @@ static void token_info_pop(struct parser https://github.com/ruby/ruby/blob/trunk/parse.y#L847
 %type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner
 %type <id>   fsym keyword_variable user_variable sym symbol operation operation2 operation3
 %type <id>   cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_bad_arg
-%type <id>   f_kwrest f_label f_arg_asgn call_op call_op2 lbracket
+%type <id>   f_kwrest f_label f_arg_asgn call_op call_op2
 /*%%%*/
 /*%
 %type <val> program reswords then do dot_or_colon
@@ -1246,15 +1243,11 @@ stmt		: keyword_alias fitem {lex_state = https://github.com/ruby/ruby/blob/trunk/parse.y#L1243
 			value_expr($3);
 			$$ = new_op_assign($1, $2, $3);
 		    }
-		| primary_value lbracket opt_call_args rbracket tOP_ASGN command_call
+		| primary_value '[' opt_call_args rbracket tOP_ASGN command_call
 		    {
 		    /*%%%*/
 			NODE *args;
-		    /*%
-		    %*/
 
-			NO_QCALL($2, "lhs of op_asgn");
-		    /*%%%*/
 			value_expr($6);
 			if (!$3) $3 = NEW_ZARRAY();
 			args = arg_concat($3, $6);
@@ -1716,9 +1709,8 @@ mlhs_node	: user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1709
 		    {
 		        $$ = assignable($1, 0);
 		    }
-		| primary_value lbracket opt_call_args rbracket
+		| primary_value '[' opt_call_args rbracket
 		    {
-			NO_QCALL($2, "mlhs");
 		    /*%%%*/
 			$$ = aryset($1, $3);
 		    /*%
@@ -1808,9 +1800,8 @@ lhs		: user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1800
 		        $$ = dispatch1(var_field, $$);
 		    %*/
 		    }
-		| primary_value lbracket opt_call_args rbracket
+		| primary_value '[' opt_call_args rbracket
 		    {
-			NO_QCALL($2, "lhs");
 		    /*%%%*/
 			$$ = aryset($1, $3);
 		    /*%
@@ -2051,15 +2042,11 @@ arg		: lhs '=' arg https://github.com/ruby/ruby/blob/trunk/parse.y#L2042
 		    %*/
 			$$ = new_op_assign($1, $2, $3);
 		    }
-		| primary_value lbracket opt_call_args rbracket tOP_ASGN arg
+		| primary_value '[' opt_call_args rbracket tOP_ASGN arg
 		    {
 		    /*%%%*/
 			NODE *args;
-		    /*%
-		    %*/
 
-			NO_QCALL($2, "lhs of op_asgn");
-		    /*%%%*/
 			value_expr($6);
 			if (!$3) $3 = NEW_ZARRAY();
 			if (nd_type($3) == NODE_BLOCK_PASS) {
@@ -3754,13 +3741,13 @@ method_call	: fcall paren_args https://github.com/ruby/ruby/blob/trunk/parse.y#L3741
 			$$ = dispatch0(zsuper);
 		    %*/
 		    }
-		| primary_value lbracket opt_call_args rbracket
+		| primary_value '[' opt_call_args rbracket
 		    {
 		    /*%%%*/
-			if ($2 != tDOTQ && $1 && nd_type($1) == NODE_SELF)
+			if ($1 && nd_type($1) == NODE_SELF)
 			    $$ = NEW_FCALL(tAREF, $3);
 			else
-			    $$ = NEW_QCALL($2, $1, tAREF, $3);
+			    $$ = NEW_CALL($1, tAREF, $3);
 			fixpos($$, $1);
 		    /*%
 			$$ = dispatch2(aref, $1, escape_Qundef($3));
@@ -5171,10 +5158,6 @@ opt_nl		: /* none */ https://github.com/ruby/ruby/blob/trunk/parse.y#L5158
 rparen		: opt_nl ')'
 		;
 
-lbracket	: '[' {$$ = 0;}
-		| tDOTQ '[' {$$ = tDOTQ;}
-		;
-
 rbracket	: opt_nl ']'
 		;
 
Index: test/ruby/test_call.rb
===================================================================
--- test/ruby/test_call.rb	(revision 52429)
+++ test/ruby/test_call.rb	(revision 52430)
@@ -46,13 +46,9 @@ class TestCall < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_call.rb#L46
     assert_equal(5, o.y)
     o.?z ||= 6
     assert_equal(6, o.z)
-    assert_equal(42, o.?[:x])
-    assert_equal(42, o.?["x"])
 
     o = nil
     assert_nil(o.?x)
-    assert_nil(o.?[:x])
-    assert_nil(o.?["x"])
     assert_nothing_raised(NoMethodError) {o.?x = 6}
     assert_nothing_raised(NoMethodError) {o.?x *= 7}
   end

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

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