correctly handle anonymous variables when reading
This commit is contained in:
@@ -121,9 +121,18 @@ pub(crate) fn write_term_to_heap(term: &Term, machine_st: &mut MachineState) ->
|
|||||||
| &TermRef::Var(Level::Root, ..)
|
| &TermRef::Var(Level::Root, ..)
|
||||||
| &TermRef::Constant(Level::Root, ..) =>
|
| &TermRef::Constant(Level::Root, ..) =>
|
||||||
machine_st.heap.push(HeapCellValue::Addr(term.as_addr(h))),
|
machine_st.heap.push(HeapCellValue::Addr(term.as_addr(h))),
|
||||||
&TermRef::AnonVar(_) =>
|
&TermRef::AnonVar(_) => {
|
||||||
continue,
|
if let Some((arity, site_h)) = queue.pop_front() {
|
||||||
|
if arity > 1 {
|
||||||
|
queue.push_front((arity - 1, site_h + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
},
|
||||||
&TermRef::Var(_, _, ref var) => {
|
&TermRef::Var(_, _, ref var) => {
|
||||||
|
let v = var.as_str();
|
||||||
|
|
||||||
if let Some((arity, site_h)) = queue.pop_front() {
|
if let Some((arity, site_h)) = queue.pop_front() {
|
||||||
if let Some(addr) = var_dict.get(var).cloned() {
|
if let Some(addr) = var_dict.get(var).cloned() {
|
||||||
machine_st.heap[site_h] = HeapCellValue::Addr(addr);
|
machine_st.heap[site_h] = HeapCellValue::Addr(addr);
|
||||||
|
|||||||
Reference in New Issue
Block a user