The cdr may have moved, so we can't look at the target object
type. Fortunately, the base type encoded in the reference itself is
sufficient to check for a non-cons cdr.
Signed-off-by: Keith Packard <keithp@keithp.com>
cdr = cons->cdr;
if (!cdr)
break;
- if (ao_lisp_poly_type(cdr) != AO_LISP_CONS) {
- (void) ao_lisp_poly_move(&cons->cdr, 1);
+ if (ao_lisp_poly_base_type(cdr) != AO_LISP_CONS) {
+ (void) ao_lisp_poly_move(&cons->cdr, 0);
break;
}
c = ao_lisp_poly_cons(cdr);
ao_lisp_poly_stash(0, car);
ao_lisp_poly_stash(1, cdr);
cons = ao_lisp_alloc(sizeof (struct ao_lisp_cons));
- car = ao_lisp_poly_fetch(0);
cdr = ao_lisp_poly_fetch(1);
+ car = ao_lisp_poly_fetch(0);
if (!cons)
return NULL;
}