From: Mark Thom Date: Sun, 10 Apr 2022 20:17:33 +0000 (-0600) Subject: mark variable referents in stackful iterator, fix tests (#1408) X-Git-Tag: v0.9.1~61 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=95c192a988f4356124934d4403c7505f705025dd;p=scryer-prolog.git mark variable referents in stackful iterator, fix tests (#1408) --- diff --git a/src/heap_iter.rs b/src/heap_iter.rs index b8670de3..a7a7e7b6 100644 --- a/src/heap_iter.rs +++ b/src/heap_iter.rs @@ -171,8 +171,8 @@ impl<'a> StackfulPreOrderHeapIter<'a> { return Some(self.heap[h]); } (HeapCellValueTag::AttrVar | HeapCellValueTag::PStrLoc | HeapCellValueTag::Var, vh) => { - self.push_if_unmarked(h); - self.stack.push(IterStackLoc::iterable_heap_loc(vh)); + self.push_if_unmarked(vh); + self.stack.push(IterStackLoc::mark_heap_loc(vh)); forward_if_referent_marked(&mut self.heap, vh); } (HeapCellValueTag::PStrOffset, offset) => { @@ -1467,7 +1467,7 @@ mod tests { ); assert_eq!( unmark_cell_bits!(iter.next().unwrap()), - list_loc_as_cell!(1) + heap_loc_as_cell!(0) ); assert_eq!(iter.next(), None); @@ -1739,7 +1739,10 @@ mod tests { cyclic_link.set_forwarding_bit(true); cyclic_link.set_mark_bit(true); - assert_eq!(iter.next().unwrap(), list_loc_as_cell!(1)); + assert_eq!( + unmark_cell_bits!(iter.next().unwrap()), + list_loc_as_cell!(1) + ); assert_eq!( unmark_cell_bits!(iter.next().unwrap()), list_loc_as_cell!(1) @@ -1803,7 +1806,7 @@ mod tests { assert_eq!( unmark_cell_bits!(iter.next().unwrap()), - str_loc_as_cell!(1) + heap_loc_as_cell!(0) ); assert_eq!( @@ -1975,7 +1978,7 @@ mod tests { ); assert_eq!( unmark_cell_bits!(iter.next().unwrap()), - list_loc_as_cell!(1) + heap_loc_as_cell!(0) ); assert_eq!( unmark_cell_bits!(iter.next().unwrap()), diff --git a/src/loader.pl b/src/loader.pl index a5978550..ba036061 100644 --- a/src/loader.pl +++ b/src/loader.pl @@ -28,11 +28,10 @@ write_error(Error) :- ), ( nonvar(Error), functor(Error, error, 2) -> - writeq(Error), - write('.') - ; writeq(throw(Error)), - write('.') - ). + writeq(Error) + ; writeq(throw(Error)) + ), + write('.'). '$print_message_and_fail'(Error) :- ( ( Error = error(existence_error(procedure, Expansion), Expansion)