From 39efc12dc86502bfa0563c605e5dcaf0936b6d68 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Sat, 11 Dec 2021 21:51:45 -0700 Subject: [PATCH] generate heap_loc cells to refer to 0-arity atoms in read.rs --- src/read.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/read.rs b/src/read.rs index b4c4dbcc..eced1d72 100644 --- a/src/read.rs +++ b/src/read.rs @@ -292,6 +292,7 @@ impl<'a, 'b> TermWriter<'a, 'b> { }, &TermRef::PartialString(..) => pstr_loc_as_cell!(h), &TermRef::Literal(_, _, literal) => HeapCellValue::from(*literal), + &TermRef::Clause(_,_,_,subterms) if subterms.len() == 0 => heap_loc_as_cell!(h), &TermRef::Clause(..) => str_loc_as_cell!(h), } } @@ -319,7 +320,11 @@ impl<'a, 'b> TermWriter<'a, 'b> { self.push_stub_addr(); } &TermRef::Clause(Level::Root, _, ref ct, subterms) => { - self.heap.push(str_loc_as_cell!(heap_loc + 1)); + self.heap.push(if subterms.len() == 0 { + heap_loc_as_cell!(heap_loc + 1) + } else { + str_loc_as_cell!(heap_loc + 1) + }); self.queue.push_back((subterms.len(), h + 2)); let named = atom_as_cell!(ct.name(), subterms.len()); -- 2.54.0