summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-17 13:25:14 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-17 13:25:14 +0000
commit6170db409b52e1048f68fe6a883f40e0ab72be62 (patch)
tree76ee0353d3fedd90b5427fa32789219649885499 /compile.c
parentb66b645230542bf2a1a782d80a7426947a9a273f (diff)
merge revision(s) 49193: [Backport #10719]
* 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/branches/ruby_2_2@49302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/compile.c b/compile.c
index ac8fad9760..666e1acace 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) {