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

ruby-changes:47991

From: nobu <ko1@a...>
Date: Tue, 3 Oct 2017 13:56:28 +0900 (JST)
Subject: [ruby-changes:47991] nobu:r60105 (trunk): parse.y: extract callback results

nobu	2017-10-03 13:56:23 +0900 (Tue, 03 Oct 2017)

  New Revision: 60105

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

  Log:
    parse.y: extract callback results
    
    * parse.y: stripping wrapping NODEs from ripper callback results,
      when storing in Array objects.  NODEs must not appear in Ruby
      level.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60104)
+++ parse.y	(revision 60105)
@@ -1915,7 +1915,7 @@ undef_list	: fitem https://github.com/ruby/ruby/blob/trunk/parse.y#L1915
 		    /*%%%*/
 			$$ = NEW_UNDEF($1);
 		    /*%
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    %*/
 		    }
 		| undef_list ',' {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
@@ -1923,7 +1923,7 @@ undef_list	: fitem https://github.com/ruby/ruby/blob/trunk/parse.y#L1923
 		    /*%%%*/
 			$$ = block_append($1, NEW_UNDEF($4));
 		    /*%
-			rb_ary_push($1, $4);
+			rb_ary_push($1, get_value($4));
 		    %*/
 		    }
 		;
@@ -3310,14 +3310,14 @@ bv_decls	: bvar https://github.com/ruby/ruby/blob/trunk/parse.y#L3310
 		    /*%c%*/
 		    /*%c
 		    {
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    }
 		    %*/
 		| bv_decls ',' bvar
 		    /*%c%*/
 		    /*%c
 		    {
-			rb_ary_push($1, $3);
+			rb_ary_push($1, get_value($3));
 		    }
 		    %*/
 		;
@@ -3630,7 +3630,7 @@ exc_list	: arg_value https://github.com/ruby/ruby/blob/trunk/parse.y#L3630
 		    /*%%%*/
 			$$ = NEW_LIST($1);
 		    /*%
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    %*/
 		    }
 		| mrhs
@@ -4400,7 +4400,7 @@ f_arg		: f_arg_item https://github.com/ruby/ruby/blob/trunk/parse.y#L4400
 		    /*%c%*/
 		    /*%c
 		    {
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    }
 		    c%*/
 		| f_arg ',' f_arg_item
@@ -4411,7 +4411,7 @@ f_arg		: f_arg_item https://github.com/ruby/ruby/blob/trunk/parse.y#L4411
 			$$->nd_next = block_append($$->nd_next, $3->nd_next);
 			rb_gc_force_recycle((VALUE)$3);
 		    /*%
-			$$ = rb_ary_push($1, $3);
+			$$ = rb_ary_push($1, get_value($3));
 		    %*/
 		    }
 		;
@@ -4433,7 +4433,7 @@ f_kw		: f_label arg_value https://github.com/ruby/ruby/blob/trunk/parse.y#L4433
 		    /*%%%*/
 			$$ = new_kw_arg($$);
 		    /*%
-			$$ = rb_assoc_new($$, $2);
+			$$ = rb_assoc_new(get_value($$), get_value($1));
 		    %*/
 		    }
 		| f_label
@@ -4443,7 +4443,7 @@ f_kw		: f_label arg_value https://github.com/ruby/ruby/blob/trunk/parse.y#L4443
 		    /*%%%*/
 			$$ = new_kw_arg($$);
 		    /*%
-			$$ = rb_assoc_new($$, 0);
+			$$ = rb_assoc_new(get_value($$), 0);
 		    %*/
 		    }
 		;
@@ -4454,7 +4454,7 @@ f_block_kw	: f_label primary_value https://github.com/ruby/ruby/blob/trunk/parse.y#L4454
 		    /*%%%*/
 			$$ = new_kw_arg($$);
 		    /*%
-			$$ = rb_assoc_new($$, $2);
+			$$ = rb_assoc_new(get_value($$), get_value($2));
 		    %*/
 		    }
 		| f_label
@@ -4463,7 +4463,7 @@ f_block_kw	: f_label primary_value https://github.com/ruby/ruby/blob/trunk/parse.y#L4463
 		    /*%%%*/
 			$$ = new_kw_arg($$);
 		    /*%
-			$$ = rb_assoc_new($$, 0);
+			$$ = rb_assoc_new(get_value($$), 0);
 		    %*/
 		    }
 		;
@@ -4473,7 +4473,7 @@ f_block_kwarg	: f_block_kw https://github.com/ruby/ruby/blob/trunk/parse.y#L4473
 		    /*%%%*/
 			$$ = $1;
 		    /*%
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    %*/
 		    }
 		| f_block_kwarg ',' f_block_kw
@@ -4481,7 +4481,7 @@ f_block_kwarg	: f_block_kw https://github.com/ruby/ruby/blob/trunk/parse.y#L4481
 		    /*%%%*/
 			$$ = kwd_append($1, $3);
 		    /*%
-			$$ = rb_ary_push($1, $3);
+			$$ = rb_ary_push($1, get_value($3));
 		    %*/
 		    }
 		;
@@ -4492,7 +4492,7 @@ f_kwarg		: f_kw https://github.com/ruby/ruby/blob/trunk/parse.y#L4492
 		    /*%%%*/
 			$$ = $1;
 		    /*%
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    %*/
 		    }
 		| f_kwarg ',' f_kw
@@ -4500,7 +4500,7 @@ f_kwarg		: f_kw https://github.com/ruby/ruby/blob/trunk/parse.y#L4500
 		    /*%%%*/
 			$$ = kwd_append($1, $3);
 		    /*%
-			$$ = rb_ary_push($1, $3);
+			$$ = rb_ary_push($1, get_value($3));
 		    %*/
 		    }
 		;
@@ -4536,7 +4536,7 @@ f_opt		: f_arg_asgn '=' arg_value https://github.com/ruby/ruby/blob/trunk/parse.y#L4536
 		    /*%%%*/
 			$$ = NEW_OPT_ARG(0, $$);
 		    /*%
-			$$ = rb_assoc_new($$, $3);
+			$$ = rb_assoc_new(get_value($$), get_value($3));
 		    %*/
 		    }
 		;
@@ -4548,7 +4548,7 @@ f_block_opt	: f_arg_asgn '=' primary_val https://github.com/ruby/ruby/blob/trunk/parse.y#L4548
 		    /*%%%*/
 			$$ = NEW_OPT_ARG(0, $$);
 		    /*%
-			$$ = rb_assoc_new($$, $3);
+			$$ = rb_assoc_new(get_value($$), get_value($3));
 		    %*/
 		    }
 		;
@@ -4558,7 +4558,7 @@ f_block_optarg	: f_block_opt https://github.com/ruby/ruby/blob/trunk/parse.y#L4558
 		    /*%%%*/
 			$$ = $1;
 		    /*%
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    %*/
 		    }
 		| f_block_optarg ',' f_block_opt
@@ -4572,7 +4572,7 @@ f_block_optarg	: f_block_opt https://github.com/ruby/ruby/blob/trunk/parse.y#L4572
 			opts->nd_next = $3;
 			$$ = $1;
 		    /*%
-			$$ = rb_ary_push($1, $3);
+			$$ = rb_ary_push($1, get_value($3));
 		    %*/
 		    }
 		;
@@ -4582,7 +4582,7 @@ f_optarg	: f_opt https://github.com/ruby/ruby/blob/trunk/parse.y#L4582
 		    /*%%%*/
 			$$ = $1;
 		    /*%
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    %*/
 		    }
 		| f_optarg ',' f_opt
@@ -4596,7 +4596,7 @@ f_optarg	: f_opt https://github.com/ruby/ruby/blob/trunk/parse.y#L4596
 			opts->nd_next = $3;
 			$$ = $1;
 		    /*%
-			$$ = rb_ary_push($1, $3);
+			$$ = rb_ary_push($1, get_value($3));
 		    %*/
 		    }
 		;
@@ -4719,7 +4719,7 @@ assocs		: assoc https://github.com/ruby/ruby/blob/trunk/parse.y#L4719
 		    /*%c%*/
 		    /*%c
 		    {
-			$$ = rb_ary_new3(1, $1);
+			$$ = rb_ary_new3(1, get_value($1));
 		    }
 		    %*/
 		| assocs ',' assoc
@@ -4741,7 +4741,7 @@ assocs		: assoc https://github.com/ruby/ruby/blob/trunk/parse.y#L4741
 			}
 			$$ = assocs;
 		    /*%
-			$$ = rb_ary_push($1, $3);
+			$$ = rb_ary_push($1, get_value($3));
 		    %*/
 		    }
 		;

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

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