wrap resource_error into an error/2 functor and don't wrap it into a syntax_error functor

This commit is contained in:
Skgland
2025-11-20 00:48:04 +01:00
committed by Bennet Bleßmann
parent 6063783e9d
commit 516848e214
3 changed files with 32 additions and 20 deletions

View File

@@ -379,9 +379,7 @@ impl<'a> TermWriter<'a> {
#[inline]
fn push_cell(&mut self, cell: HeapCellValue) -> Result<(), CompilationError> {
self.heap
.push_cell(cell)
.map_err(|err| err.to_compilation_error(self.heap))
Ok(self.heap.push_cell(cell)?)
}
fn term_as_addr(&mut self, term: &TermRef, h: usize) -> HeapCellValue {
@@ -475,10 +473,7 @@ impl<'a> TermWriter<'a> {
self.push_stub_addr()?;
}
let cell = self
.heap
.allocate_cstr(src)
.map_err(|err| err.to_compilation_error(self.heap))?;
let cell = self.heap.allocate_cstr(src)?;
let new_h = self.heap.cell_len();
self.push_cell(cell)?;
@@ -496,10 +491,7 @@ impl<'a> TermWriter<'a> {
self.push_stub_addr()?;
}
let cell = self
.heap
.allocate_pstr(src)
.map_err(|err| err.to_compilation_error(self.heap))?;
let cell = self.heap.allocate_pstr(src)?;
let tail_h = self.heap.cell_len();
self.push_stub_addr()?;