From 17a65c320d9ce3bce3d7fe0177d74bf78314b8fa Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 9 Jan 2015 02:13:03 +0000 Subject: 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 --- compile.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index d69dab6..b573168 100644 --- a/compile.c +++ b/compile.c @@ -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) { -- cgit v1.1