summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 10:15:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 10:15:16 +0000
commit399a32dfca7bbf2cb770cb7cd422b30ac220f01c (patch)
tree7e84ef94bcea086a222aeeff9a7111d6c2f0cae0 /compile.c
parentf77c97a8ca966ba2a0303b838fa7e04ebc311ecb (diff)
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.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index ebb58bba8d..3ad7192ca0 100644
--- a/compile.c
+++ b/compile.c
@@ -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);