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

ruby-changes:57639

From: Yusuke <ko1@a...>
Date: Sat, 7 Sep 2019 13:57:08 +0900 (JST)
Subject: [ruby-changes:57639] a7a2be7a31 (master): Rename some function/definition names that handles NODE_LIST

https://git.ruby-lang.org/ruby.git/commit/?id=a7a2be7a31

From a7a2be7a31b66b05a118fb41dabf0cb965f4a9c0 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Sat, 7 Sep 2019 13:51:18 +0900
Subject: Rename some function/definition names that handles NODE_LIST

from array to list.
Follow up to ac50ac03aeb210763730cdc45f230e236519223d

diff --git a/compile.c b/compile.c
index 6f9e2aa..ed9deea 100644
--- a/compile.c
+++ b/compile.c
@@ -3872,7 +3872,7 @@ compile_args(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node_roo https://github.com/ruby/ruby/blob/trunk/compile.c#L3872
     return len;
 }
 
-enum compile_array_type_t {
+enum compile_list_type_t {
     COMPILE_ARRAY_TYPE_ARRAY,
     COMPILE_ARRAY_TYPE_HASH,
 };
@@ -3922,8 +3922,8 @@ static_literal_value(const NODE *node, rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/compile.c#L3922
 }
 
 static int
-compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node_root,
-              enum compile_array_type_t type, int popped)
+compile_list(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node_root,
+              enum compile_list_type_t type, int popped)
 {
     const NODE *node = node_root;
     int line = (int)nd_line(node);
@@ -3952,7 +3952,7 @@ compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node_ro https://github.com/ruby/ruby/blob/trunk/compile.c#L3952
 
 	    for (i=0; i<max && node; i++, len++, node = node->nd_next) {
 		if (CPDEBUG > 0) {
-		    EXPECT_NODE("compile_array", node, NODE_LIST, -1);
+		    EXPECT_NODE("compile_list", node, NODE_LIST, -1);
 		}
 
                 if (type == COMPILE_ARRAY_TYPE_HASH && !node->nd_head) {
@@ -4840,7 +4840,7 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn, https://github.com/ruby/ruby/blob/trunk/compile.c#L4840
           }
           case NODE_ARGSCAT:
           case NODE_ARGSPUSH: {
-            int next_is_array = (nd_type(argn->nd_head) == NODE_LIST);
+            int next_is_list = (nd_type(argn->nd_head) == NODE_LIST);
             VALUE argc = setup_args_core(iseq, args, argn->nd_head, 1, NULL, NULL);
             NO_CHECK(COMPILE(args, "args (cat: splat)", argn->nd_body));
             if (flag) {
@@ -4851,7 +4851,7 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn, https://github.com/ruby/ruby/blob/trunk/compile.c#L4851
                     *flag |= VM_CALL_KW_SPLAT;
             }
             if (nd_type(argn) == NODE_ARGSCAT) {
-                if (next_is_array) {
+                if (next_is_list) {
                     ADD_INSN1(args, nd_line(argn), splatarray, Qtrue);
                     return INT2FIX(FIX2INT(argc) + 1);
                 }
@@ -7435,7 +7435,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7435
 	break;
       }
       case NODE_LIST:{
-        CHECK(compile_array(iseq, ret, node, COMPILE_ARRAY_TYPE_ARRAY, popped) >= 0);
+        CHECK(compile_list(iseq, ret, node, COMPILE_ARRAY_TYPE_ARRAY, popped) >= 0);
 	break;
       }
       case NODE_ZLIST:{
@@ -7463,7 +7463,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L7463
 	INIT_ANCHOR(list);
 	switch (type) {
 	  case NODE_LIST:
-            CHECK(compile_array(iseq, list, node->nd_head, COMPILE_ARRAY_TYPE_HASH, popped) >= 0);
+            CHECK(compile_list(iseq, list, node->nd_head, COMPILE_ARRAY_TYPE_HASH, popped) >= 0);
 	    ADD_SEQ(ret, list);
 	    break;
 
diff --git a/parse.y b/parse.y
index 82fbf5f..5408e1a 100644
--- a/parse.y
+++ b/parse.y
@@ -460,7 +460,7 @@ static NODE *new_defined(struct parser_params *p, NODE *expr, const YYLTYPE *loc https://github.com/ruby/ruby/blob/trunk/parse.y#L460
 
 static NODE *new_regexp(struct parser_params *, NODE *, int, const YYLTYPE *);
 
-#define make_array(ary, loc) ((ary) ? (nd_set_loc(ary, loc), ary) : NEW_ZLIST(loc))
+#define make_list(list, loc) ((list) ? (nd_set_loc(list, loc), list) : NEW_ZLIST(loc))
 
 static NODE *new_xstring(struct parser_params *, NODE *, const YYLTYPE *loc);
 
@@ -2606,7 +2606,7 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2606
 		| tLBRACK aref_args ']'
 		    {
 		    /*%%%*/
-			$$ = make_array($2, &@$);
+			$$ = make_list($2, &@$);
 		    /*% %*/
 		    /*% ripper: array!(escape_Qundef($2)) %*/
 		    }
@@ -4293,7 +4293,7 @@ regexp		: tREGEXP_BEG regexp_contents tREGEXP_END https://github.com/ruby/ruby/blob/trunk/parse.y#L4293
 words		: tWORDS_BEG ' ' word_list tSTRING_END
 		    {
 		    /*%%%*/
-			$$ = make_array($3, &@$);
+			$$ = make_list($3, &@$);
 		    /*% %*/
 		    /*% ripper: array!($3) %*/
 		    }
@@ -4329,7 +4329,7 @@ word		: string_content https://github.com/ruby/ruby/blob/trunk/parse.y#L4329
 symbols 	: tSYMBOLS_BEG ' ' symbol_list tSTRING_END
 		    {
 		    /*%%%*/
-			$$ = make_array($3, &@$);
+			$$ = make_list($3, &@$);
 		    /*% %*/
 		    /*% ripper: array!($3) %*/
 		    }
@@ -4354,7 +4354,7 @@ symbol_list	: /* none */ https://github.com/ruby/ruby/blob/trunk/parse.y#L4354
 qwords		: tQWORDS_BEG ' ' qword_list tSTRING_END
 		    {
 		    /*%%%*/
-			$$ = make_array($3, &@$);
+			$$ = make_list($3, &@$);
 		    /*% %*/
 		    /*% ripper: array!($3) %*/
 		    }
@@ -4363,7 +4363,7 @@ qwords		: tQWORDS_BEG ' ' qword_list tSTRING_END https://github.com/ruby/ruby/blob/trunk/parse.y#L4363
 qsymbols	: tQSYMBOLS_BEG ' ' qsym_list tSTRING_END
 		    {
 		    /*%%%*/
-			$$ = make_array($3, &@$);
+			$$ = make_list($3, &@$);
 		    /*% %*/
 		    /*% ripper: array!($3) %*/
 		    }
@@ -11451,7 +11451,7 @@ new_ary_op_assign(struct parser_params *p, NODE *ary, https://github.com/ruby/ruby/blob/trunk/parse.y#L11451
 {
     NODE *asgn;
 
-    args = make_array(args, args_loc);
+    args = make_list(args, args_loc);
     if (nd_type(args) == NODE_BLOCK_PASS) {
 	args = NEW_ARGSCAT(args, rhs, loc);
     }
-- 
cgit v0.10.2


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

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