From 8587fe6dfc2a43626518a7db8d9f447841ae53d2 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 25 Jun 2015 22:33:17 +0900 Subject: [PATCH] fix benz's issue 29 --- extlib/benz/write.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extlib/benz/write.c b/extlib/benz/write.c index a7da49e6..124ae7b4 100644 --- a/extlib/benz/write.c +++ b/extlib/benz/write.c @@ -341,7 +341,8 @@ traverse(struct writer_control *p, pic_value obj) switch (pic_type(obj)) { case PIC_TT_PAIR: - case PIC_TT_VECTOR: { + case PIC_TT_VECTOR: + case PIC_TT_DICT: { khash_t(l) *h = &p->labels; khiter_t it; int ret; @@ -355,12 +356,18 @@ traverse(struct writer_control *p, pic_value obj) /* pair */ traverse(p, pic_car(pic, obj)); traverse(p, pic_cdr(pic, obj)); - } else { + } else if (pic_vec_p(obj)) { /* vector */ size_t i; for (i = 0; i < pic_vec_ptr(obj)->len; ++i) { traverse(p, pic_vec_ptr(obj)->data[i]); } + } else { + /* dictionary */ + pic_sym *sym; + pic_dict_for_each (sym, pic_dict_ptr(obj), it) { + traverse(p, pic_dict_ref(pic, pic_dict_ptr(obj), sym)); + } } if (p->op == OP_WRITE) {