report pre-marked values from eager stackful iterator (#2097)
This commit is contained in:
@@ -59,6 +59,14 @@ impl<'a> EagerStackfulPreOrderHeapIter<'a> {
|
|||||||
fn follow(&mut self) -> Option<HeapCellValue> {
|
fn follow(&mut self) -> Option<HeapCellValue> {
|
||||||
while let Some(value) = self.iter_stack.pop() {
|
while let Some(value) = self.iter_stack.pop() {
|
||||||
if value.get_mark_bit() == self.mark_phase {
|
if value.get_mark_bit() == self.mark_phase {
|
||||||
|
if value.is_var() {
|
||||||
|
let h = value.get_value() as usize;
|
||||||
|
|
||||||
|
if self.heap[h].is_var() && self.heap[h].get_value() as usize == h {
|
||||||
|
return Some(unmark_cell_bits!(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,17 @@ test("term_variables#2063", (
|
|||||||
Vars = [C]
|
Vars = [C]
|
||||||
)).
|
)).
|
||||||
|
|
||||||
|
test("term_variables#2097", (
|
||||||
|
termt(T), term_variables(T,Vs),
|
||||||
|
T = [[[A|B]|A]|A], Vs == [A,B]
|
||||||
|
)).
|
||||||
|
|
||||||
|
termt(T) :-
|
||||||
|
T = [T1|T2],
|
||||||
|
T1 = [T3|A],
|
||||||
|
T3 = [A|_],
|
||||||
|
T2 = A.
|
||||||
|
|
||||||
main :-
|
main :-
|
||||||
findall(test(Name, Goal), test(Name, Goal), Tests),
|
findall(test(Name, Goal), test(Name, Goal), Tests),
|
||||||
run_tests(Tests, Failed),
|
run_tests(Tests, Failed),
|
||||||
|
|||||||
Reference in New Issue
Block a user