diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 10:15:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 10:15:16 +0000 |
commit | 399a32dfca7bbf2cb770cb7cd422b30ac220f01c (patch) | |
tree | 7e84ef94bcea086a222aeeff9a7111d6c2f0cae0 /compile.c | |
parent | f77c97a8ca966ba2a0303b838fa7e04ebc311ecb (diff) | |
download | ruby-399a32dfca7bbf2cb770cb7cd422b30ac220f01c.tar.gz |
compile.c: hash must be paired
* compile.c (compile_array_): hash elements must be paired even for
literal elements. [ruby-dev:46658] [Bug #7466]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -2379,11 +2379,15 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root, rb_ary_push(ary, node->nd_head->nd_lit); node = node->nd_next; } - while (node && nd_type(node->nd_head) == NODE_LIT) { + while (node && nd_type(node->nd_head) == NODE_LIT && + node->nd_next && nd_type(node->nd_next->nd_head) == NODE_LIT) { + rb_ary_push(ary, node->nd_head->nd_lit); + node = node->nd_next; rb_ary_push(ary, node->nd_head->nd_lit); node = node->nd_next; len++; } + assert(RARRAY_LEN(ary) % 2 == 0); OBJ_FREEZE(ary); |