From c36a6f97f243778d3eb8e973eba89ce2b424b707 Mon Sep 17 00:00:00 2001 From: mame Date: Fri, 15 Mar 2019 05:19:54 +0000 Subject: node.h: introduce nd_brace to determine if a hash literal is a keyword NODE_HASH#nd_brace is a flag that is 1 for `foo({ k: 1 })` and 0 for `foo(k: 1)`. nd_alen had been abused for the flag (and the implementation is completely the same), but an explicit name is better to read. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- node.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'node.c') diff --git a/node.c b/node.c index b560d24a29..9196280d56 100644 --- a/node.c +++ b/node.c @@ -557,7 +557,7 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node) return; case NODE_HASH: - if (!node->nd_alen) { + if (!node->nd_brace) { ANN("keyword arguments"); ANN("format: nd_head"); ANN("example: a: 1, b: 2"); @@ -567,8 +567,8 @@ dump_node(VALUE buf, VALUE indent, int comment, const 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) { + F_CUSTOM1(nd_brace, "keyword arguments or hash literal") { + switch (node->nd_brace) { case 0: A("0 (keyword argument)"); break; case 1: A("1 (hash literal)"); break; } -- cgit v1.2.1