harmonize partial strings with complete strings (#276), make Addr a copyable type

This commit is contained in:
Mark Thom
2020-04-03 10:22:46 -06:00
parent cac76d4739
commit 141f3bcec3
33 changed files with 1229 additions and 885 deletions

View File

@@ -153,7 +153,8 @@ pub struct TermWriteResult {
pub(crate) var_dict: HeapVarDict,
}
pub(crate) fn write_term_to_heap(term: &Term, machine_st: &mut MachineState) -> TermWriteResult {
pub(crate)
fn write_term_to_heap(term: &Term, machine_st: &mut MachineState) -> TermWriteResult {
let heap_loc = machine_st.heap.h();
let mut queue = SubtermDeque::new();
@@ -188,13 +189,13 @@ pub(crate) fn write_term_to_heap(term: &Term, machine_st: &mut MachineState) ->
continue;
}
}
&TermRef::AnonVar(Level::Root) | &TermRef::Constant(Level::Root, ..) => {
let value = HeapCellValue::Addr(term.as_addr(&mut machine_st.heap, h));
machine_st.heap.push(value);
}
&TermRef::Var(Level::Root, ..) => {
let value = HeapCellValue::Addr(term.as_addr(&mut machine_st.heap, h));
machine_st.heap.push(value);
&TermRef::AnonVar(Level::Root) | &TermRef::Constant(Level::Root, ..)
| &TermRef::Var(Level::Root, ..) => {
let addr = term.as_addr(&mut machine_st.heap, h);
if !addr.is_heap_bound() {
machine_st.heap.push(HeapCellValue::Addr(addr));
}
}
&TermRef::AnonVar(_) => {
if let Some((arity, site_h)) = queue.pop_front() {