diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-11 01:27:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-11 01:27:24 +0000 |
commit | ba8a904f95f0ba6879f3e0309add3b902f9fbbfc (patch) | |
tree | 7998cf9313f4c5e462b6933f5067f13d6974ce50 /node.c | |
parent | b1b909d0cae979a8661219e58531694479e46f8d (diff) | |
download | ruby-ba8a904f95f0ba6879f3e0309add3b902f9fbbfc.tar.gz |
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
Diffstat (limited to 'node.c')
-rw-r--r-- | node.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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; |