Commit ad568495 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Have the boxed versions just box the output of the unboxed versions

parent cf211158
......@@ -52,13 +52,6 @@ class BoxedXrangeIterator : public Box {
BoxedXrangeIterator *self = static_cast<BoxedXrangeIterator*>(s);
}
static Box* xrangeIteratorHasnext(Box *s) __attribute__((visibility("default"))) {
assert(s->cls == xrange_iterator_cls);
BoxedXrangeIterator *self = static_cast<BoxedXrangeIterator*>(s);
assert(self->xrange->step > 0);
return boxBool(self->cur < self->xrange->stop);
}
static bool xrangeIteratorHasnextUnboxed(Box *s) __attribute__((visibility("default"))) {
assert(s->cls == xrange_iterator_cls);
BoxedXrangeIterator *self = static_cast<BoxedXrangeIterator*>(s);
......@@ -66,13 +59,8 @@ class BoxedXrangeIterator : public Box {
return self->cur < self->xrange->stop;
}
static Box* xrangeIteratorNext(Box *s) __attribute__((visibility("default"))) {
assert(s->cls == xrange_iterator_cls);
BoxedXrangeIterator *self = static_cast<BoxedXrangeIterator*>(s);
i64 rtn = self->cur;
self->cur += self->xrange->step;
return boxInt(rtn);
static Box* xrangeIteratorHasnext(Box *s) __attribute__((visibility("default"))) {
return boxBool(xrangeIteratorHasnextUnboxed(s));
}
static i64 xrangeIteratorNextUnboxed(Box *s) __attribute__((visibility("default"))) {
......@@ -84,6 +72,10 @@ class BoxedXrangeIterator : public Box {
return rtn;
}
static Box* xrangeIteratorNext(Box *s) __attribute__((visibility("default"))) {
return boxInt(xrangeIteratorNextUnboxed(s));
}
static void xrangeIteratorGCHandler(GCVisitor *v, void* p) {
boxGCHandler(v, p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment