From: Mark Thom Date: Sun, 6 Feb 2022 22:14:18 +0000 (-0700) Subject: reference partial strings properly in read_term (#1271) X-Git-Tag: v0.9.0^2~30 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=f3f3dccf8e36ca2922552b1b27c771a6eb836519;p=scryer-prolog.git reference partial strings properly in read_term (#1271) --- diff --git a/src/machine/machine_state.rs b/src/machine/machine_state.rs index 5d8e591d..5b859fa9 100644 --- a/src/machine/machine_state.rs +++ b/src/machine/machine_state.rs @@ -495,9 +495,18 @@ impl MachineState { loop { match self.read(stream, &indices.op_dir) { Ok(term_write_result) => { + let heap_loc = read_heap_cell!(self.heap[term_write_result.heap_loc], + (HeapCellValueTag::PStr | HeapCellValueTag::PStrOffset) => { + pstr_loc_as_cell!(term_write_result.heap_loc) + } + _ => { + heap_loc_as_cell!(term_write_result.heap_loc) + } + ); + let term = self.registers[2]; - unify_fn!(*self, heap_loc_as_cell!(term_write_result.heap_loc), term); - let term = heap_loc_as_cell!(term_write_result.heap_loc); + unify_fn!(*self, heap_loc, term); + let term = heap_loc; if self.fail { return Ok(());