diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-09 02:13:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-09 02:13:03 +0000 |
commit | 17a65c320d9ce3bce3d7fe0177d74bf78314b8fa (patch) | |
tree | c0dd92ac4fa45ecc0f92c5de908626e324b16bcb /compile.c | |
parent | 787af09e4e7500f5670078e9cf6b0381c14a2372 (diff) | |
download | ruby-17a65c320d9ce3bce3d7fe0177d74bf78314b8fa.tar.gz |
parse.y: eliminate empty hashes
* parse.y (assocs, assoc): eliminate splatting empty literal
hashes. [ruby-core:67446] [Bug #10719]
* compile.c (compile_array_): supprt splatted hash in hash type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -2467,11 +2467,14 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root, rb_bug("compile_array: This node is not NODE_ARRAY, but %s", ruby_node_name(nd_type(node))); } - if (type == COMPILE_ARRAY_TYPE_HASH && !node->nd_head) { - opt_p = 0; + if (type != COMPILE_ARRAY_TYPE_ARRAY && !node->nd_head) { kw = node->nd_next; - node = kw->nd_next; - kw = kw->nd_head; + node = 0; + if (kw) { + opt_p = 0; + node = kw->nd_next; + kw = kw->nd_head; + } break; } if (opt_p && nd_type(node->nd_head) != NODE_LIT) { |