summaryrefslogtreecommitdiff
path: root/node.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-06-04 23:11:38 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-06-04 23:17:18 +0900
commit0872ea53303499caf3584e40f2a5438e86eb4fed (patch)
tree5f855704bd7f6a7d8cfa182fc19821ec7ab5cfa8 /node.c
parent39eae6bf89773ef830b632c02737545ab9eedd35 (diff)
node.h: Avoid a magic number to represent excessed comma
`(ID)1` was assigned to NODE_ARGS#rest_arg for `{|x,| }`. This change removes the magic number by introducing an explicit macro variable for it: NODE_SPECIAL_EXCESSED_COMMA.
Diffstat (limited to 'node.c')
-rw-r--r--node.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/node.c b/node.c
index 558a4cef47..864e115472 100644
--- a/node.c
+++ b/node.c
@@ -1010,7 +1010,14 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node)
F_INT(nd_ainfo->post_args_num, "count of mandatory post-arguments");
F_NODE(nd_ainfo->post_init, "initialization of post-arguments");
F_ID(nd_ainfo->first_post_arg, "first post argument");
- F_ID(nd_ainfo->rest_arg, "rest argument");
+ F_CUSTOM1(nd_ainfo->rest_arg, "rest argument") {
+ if (node->nd_ainfo->rest_arg == NODE_SPECIAL_EXCESSED_COMMA) {
+ A("1 (excessed comma)");
+ }
+ else {
+ A_ID(node->nd_ainfo->rest_arg);
+ }
+ }
F_ID(nd_ainfo->block_arg, "block argument");
F_NODE(nd_ainfo->opt_args, "optional arguments");
F_NODE(nd_ainfo->kw_args, "keyword arguments");