summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
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);