From 03a2862b983c7dd6c1b9fd016154191213750ed3 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 11 Aug 2017 01:27:24 +0000 Subject: separate hash literal and keyword arguments * compile.c (compile_array_keyword_arg): separate keyword splat inside hash literal from argument list. * parse.y (rparen): flag hash literal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- node.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'node.c') diff --git a/node.c b/node.c index f6d551a106..0222a19af1 100644 --- a/node.c +++ b/node.c @@ -545,9 +545,16 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node) break; case NODE_HASH: - ANN("hash constructor"); - ANN("format: { [nd_head] }"); - ANN("example: { 1 => 2, 3 => 4 }"); + if (!node->nd_alen) { + ANN("keyword arguments"); + ANN("format: nd_head"); + ANN("example: a: 1, b: 2"); + } + else { + ANN("hash constructor"); + ANN("format: { [nd_head] }"); + ANN("example: { 1 => 2, 3 => 4 }"); + } LAST_NODE; F_NODE(nd_head, "contents"); break; -- cgit v1.2.1