diff options
author | Yusuke Endoh <[email protected]> | 2019-09-07 10:42:00 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2019-09-07 13:56:29 +0900 |
commit | 99c9431ea1cc538489c3da70f52121aa8bc0800b (patch) | |
tree | 564bf58b355fd9e47d954a5e10b8c395385fbeee /ast.c | |
parent | f223ab47e6e41e4a5f0307a5202b4f5c534a3596 (diff) |
Rename NODE_ARRAY to NODE_LIST to reflect its actual use cases
and NODE_ZARRAY to NODE_ZLIST.
NODE_ARRAY is used not only by an Array literal, but also the contents
of Hash literals, method call arguments, dynamic string literals, etc.
In addition, the structure of NODE_ARRAY is a linked list, not an array.
This is very confusing, so I believe `NODE_LIST` is a better name.
Diffstat (limited to 'ast.c')
-rw-r--r-- | ast.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -337,7 +337,7 @@ dump_array(rb_ast_t *ast, NODE *node) VALUE ary = rb_ary_new(); rb_ary_push(ary, NEW_CHILD(ast, node->nd_head)); - while (node->nd_next && nd_type(node->nd_next) == NODE_ARRAY) { + while (node->nd_next && nd_type(node->nd_next) == NODE_LIST) { node = node->nd_next; rb_ary_push(ary, NEW_CHILD(ast, node->nd_head)); } @@ -491,12 +491,12 @@ node_children(rb_ast_t *ast, NODE *node) return rb_ary_new_from_node_args(ast, 1, node->nd_args); case NODE_ZSUPER: return rb_ary_new_from_node_args(ast, 0); - case NODE_ARRAY: + case NODE_LIST: goto ary; case NODE_VALUES: ary: return dump_array(ast, node); - case NODE_ZARRAY: + case NODE_ZLIST: return rb_ary_new_from_node_args(ast, 0); case NODE_HASH: return rb_ary_new_from_node_args(ast, 1, node->nd_head); |