From: Mark Thom Date: Sun, 23 Oct 2022 22:30:41 +0000 (-0600) Subject: build partial strings using PStrLoc in write_term_to_heap (#1627) X-Git-Tag: v0.9.1^2~5 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=fd97b84916c8741bc925aed53c6e9a8ed26e29f0;p=scryer-prolog.git build partial strings using PStrLoc in write_term_to_heap (#1627) --- diff --git a/src/read.rs b/src/read.rs index b4176c55..c8743c2f 100644 --- a/src/read.rs +++ b/src/read.rs @@ -390,6 +390,12 @@ impl<'a, 'b> TermWriter<'a, 'b> { put_complete_string(self.heap, src.as_str(), self.atom_tbl); } &TermRef::PartialString(lvl, _, ref src, _) => { + if let Level::Root = lvl { + // Var tags can't refer directly to partial strings, + // so a PStrLoc cell must be pushed. + self.heap.push(pstr_loc_as_cell!(heap_loc + 1)); + } + allocate_pstr(self.heap, src.as_str(), self.atom_tbl); let h = self.heap.len();