quipu mercurial repository
Revisión | e8bf311b11a48d78c685bbad3bdab50fde7bdb9f (tree) |
---|---|
Tiempo | 2018-08-17 04:32:25 |
Autor | Agustina Arzille <avarzille@rise...> |
Commiter | Agustina Arzille |
Fix table iterators
@@ -605,7 +605,7 @@ | ||
605 | 605 | } |
606 | 606 | |
607 | 607 | table::iterator::iterator (interpreter *interp, object table) : |
608 | - key (interp, intobj (0)), val (interp, intobj (0)), | |
608 | + key (interp, UNBOUND), val (interp, UNBOUND), | |
609 | 609 | vec (interp, as_table(table)->vector), idx (TABVEC_OVERHEAD) |
610 | 610 | { |
611 | 611 | this->adv (); |
@@ -613,11 +613,13 @@ | ||
613 | 613 | |
614 | 614 | bool table::iterator::valid () |
615 | 615 | { |
616 | - return (this->idx < as_array(*this->vec)->len); | |
616 | + return (*this->key != UNBOUND); | |
617 | 617 | } |
618 | 618 | |
619 | 619 | void table::iterator::adv () |
620 | 620 | { |
621 | + *this->key = UNBOUND; | |
622 | + | |
621 | 623 | for (array *vecp = as_array (*this->vec); this->idx < vecp->len; ) |
622 | 624 | { |
623 | 625 | *this->key = vecp->data[idx + 0]; |