ruby-changes:48608
From: mame <ko1@a...>
Date: Thu, 9 Nov 2017 10:51:02 +0900 (JST)
Subject: [ruby-changes:48608] mame:r60723 (trunk): node.c (dump_node): add an explanation of NODE_HASH's nd_alen
mame 2017-11-09 10:50:58 +0900 (Thu, 09 Nov 2017) New Revision: 60723 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60723 Log: node.c (dump_node): add an explanation of NODE_HASH's nd_alen The field has a flag to represent if it is a keyword argument (that has no braces, e.g., `foo(k:1)`) or hash literal (that has braces, e.g., `foo({k:1})`). Modified files: trunk/node.c Index: node.c =================================================================== --- node.c (revision 60722) +++ node.c (revision 60723) @@ -585,6 +585,13 @@ dump_node(VALUE buf, VALUE indent, int c https://github.com/ruby/ruby/blob/trunk/node.c#L585 ANN("format: { [nd_head] }"); ANN("example: { 1 => 2, 3 => 4 }"); } + F_CUSTOM1(nd_alen, "keyword-arguments-or-hash-literal") { + switch (node->nd_alen) { + case 0: A("0 (keyword argument)"); break; + case 1: A("1 (hash literal)"); break; + default: A_ID(node->nd_alen); + } + } LAST_NODE; F_NODE(nd_head, "contents"); return; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/