substitute names for cyclic variables permitted by max_depth > 0 in check_for_seen using a loop (#2057)
This commit is contained in:
@@ -862,10 +862,11 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_for_seen(&mut self, max_depth: usize) -> Option<HeapCellValue> {
|
fn check_for_seen(&mut self, max_depth: usize) -> Option<HeapCellValue> {
|
||||||
if let Some(cell) = self.iter.next() {
|
if let Some(mut orig_cell) = self.iter.next() {
|
||||||
let is_cyclic = cell.get_forwarding_bit();
|
loop {
|
||||||
|
let is_cyclic = orig_cell.get_forwarding_bit();
|
||||||
|
|
||||||
let cell = heap_bound_store(self.iter.heap, heap_bound_deref(self.iter.heap, cell));
|
let cell = heap_bound_store(self.iter.heap, heap_bound_deref(self.iter.heap, orig_cell));
|
||||||
let cell = unmark_cell_bits!(cell);
|
let cell = unmark_cell_bits!(cell);
|
||||||
|
|
||||||
match self.var_names.get(&cell).cloned() {
|
match self.var_names.get(&cell).cloned() {
|
||||||
@@ -882,7 +883,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
|
|||||||
append_str!(self, &var_str);
|
append_str!(self, &var_str);
|
||||||
});
|
});
|
||||||
|
|
||||||
None
|
return None;
|
||||||
}
|
}
|
||||||
var_opt => {
|
var_opt => {
|
||||||
if is_cyclic && cell.is_compound(self.iter.heap) {
|
if is_cyclic && cell.is_compound(self.iter.heap) {
|
||||||
@@ -908,7 +909,11 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
|
|||||||
|
|
||||||
let h = cell.get_value() as usize;
|
let h = cell.get_value() as usize;
|
||||||
self.iter.push_stack(IterStackLoc::iterable_loc(h, HeapOrStackTag::Heap));
|
self.iter.push_stack(IterStackLoc::iterable_loc(h, HeapOrStackTag::Heap));
|
||||||
return self.iter.next();
|
|
||||||
|
if let Some(cell) = self.iter.next() {
|
||||||
|
orig_cell = cell;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -916,7 +921,8 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(cell)
|
return Some(cell);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user