Box* seqiterNext(Box* s) { RELEASE_ASSERT(s->cls == seqiter_cls || s->cls == seqreviter_cls, ""); BoxedSeqIter* self = static_cast<BoxedSeqIter*>(s); if (!self->next) { Box* hasnext = NULL; if (s->cls == seqiter_cls) hasnext = seqiterHasnext(s); else if (s->cls == seqreviter_cls) hasnext = seqreviterHasnext(s); else RELEASE_ASSERT(0, ""); if (hasnext == False) raiseExcHelper(StopIteration, ""); } RELEASE_ASSERT(self->next, ""); Box* r = self->next; self->next = NULL; return r; }
llvm_compat_bool seqiterHasnextUnboxed(Box* s) { return unboxBool(autoDecref(seqiterHasnext(s))); }