summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-09-07 13:51:18 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-09-07 13:56:41 +0900
commita7a2be7a31b66b05a118fb41dabf0cb965f4a9c0 (patch)
treeb078863b2abfb4c03a63b250d63e70febf3ba867
parent99c9431ea1cc538489c3da70f52121aa8bc0800b (diff)
Rename some function/definition names that handles NODE_LIST
from array to list. Follow up to ac50ac03aeb210763730cdc45f230e236519223d
-rw-r--r--compile.c16
-rw-r--r--parse.y14
2 files changed, 15 insertions, 15 deletions
diff --git a/compile.c b/compile.c
index 6f9e2aac23..ed9deea976 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
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)
}
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
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,
}
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,
*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
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
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 82fbf5f910..5408e1afac 100644
--- a/parse.y
+++ b/parse.y
@@ -460,7 +460,7 @@ static NODE *new_defined(struct parser_params *p, NODE *expr, const YYLTYPE *loc
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
| 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
words : tWORDS_BEG ' ' word_list tSTRING_END
{
/*%%%*/
- $$ = make_array($3, &@$);
+ $$ = make_list($3, &@$);
/*% %*/
/*% ripper: array!($3) %*/
}
@@ -4329,7 +4329,7 @@ word : string_content
symbols : tSYMBOLS_BEG ' ' symbol_list tSTRING_END
{
/*%%%*/
- $$ = make_array($3, &@$);
+ $$ = make_list($3, &@$);
/*% %*/
/*% ripper: array!($3) %*/
}
@@ -4354,7 +4354,7 @@ symbol_list : /* none */
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
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,
{
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);
}