fix cyclic detection of partial strings in StackfulPreOrderHeapIter (#3050)

This commit is contained in:
Mark Thom
2025-08-21 22:52:25 -07:00
parent c5389dbbf2
commit b2cfc8b6f2
2 changed files with 26 additions and 31 deletions

View File

@@ -904,16 +904,13 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
debug_assert!(cell.is_ref());
let h = if cell.get_tag() == HeapCellValueTag::PStrLoc {
self.iter.focus().value()
self.state_stack
.push(TokenOrRedirect::Atom(atom!("...")));
return None;
} else {
cell.get_value()
} as usize;
self.iter.push_stack(IterStackLoc::iterable_loc(
h,
HeapOrStackTag::Heap,
));
// as usual, the WAM's
// optimization of the Lis tag
// (conflating the location of
@@ -934,10 +931,17 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
}
}
self.iter.push_stack(IterStackLoc::iterable_loc(
h,
HeapOrStackTag::Heap,
));
if let Some(cell) = self.iter.next() {
orig_cell = cell;
continue;
}
return Some(cell);
};
}
}