aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-09 01:50:58 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-09 01:50:58 +0000
commit0f1dad7f47a4a857343fd8e931e0904aacba6f81 (patch)
tree017f8bd2b16a06908be1c66ee48e0a436bcbda58
parent5c0fdd4001b89da0fb7b6de67011c71e7a7cf592 (diff)
downloadruby-0f1dad7f47a4a857343fd8e931e0904aacba6f81.tar.gz
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})`). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--node.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/node.c b/node.c
index 885cef6c04..c424abf638 100644
--- a/node.c
+++ b/node.c
@@ -585,6 +585,13 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
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;