mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
stop updating offset in repl_expect inner functions
This commit is contained in:
parent
71e9835504
commit
283539d61a
2 changed files with 1 additions and 23 deletions
|
@ -89,8 +89,6 @@ impl<'a> ReplApp<'a> for ExpectReplApp<'a> {
|
||||||
ptr.read()
|
ptr.read()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.offset += std::mem::size_of::<Return>();
|
|
||||||
|
|
||||||
transform(self.memory, result)
|
transform(self.memory, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,25 +110,7 @@ impl<'a> ReplApp<'a> for ExpectReplApp<'a> {
|
||||||
F: Fn(&'a Self::Memory, usize) -> T,
|
F: Fn(&'a Self::Memory, usize) -> T,
|
||||||
Self::Memory: 'a,
|
Self::Memory: 'a,
|
||||||
{
|
{
|
||||||
let string_length = RefCell::new(0);
|
self.call_function_dynamic_size(main_fn_name, 24, transform)
|
||||||
|
|
||||||
let result = self.call_function_dynamic_size(main_fn_name, 24, |memory, addr| {
|
|
||||||
let last_byte_addr = addr + (3 * std::mem::size_of::<usize>()) - 1;
|
|
||||||
let last_byte = memory.deref_i8(last_byte_addr);
|
|
||||||
|
|
||||||
let is_small = last_byte < 0;
|
|
||||||
|
|
||||||
if !is_small {
|
|
||||||
let length = memory.deref_usize(addr + std::mem::size_of::<usize>());
|
|
||||||
*string_length.borrow_mut() = length;
|
|
||||||
}
|
|
||||||
|
|
||||||
transform(memory, addr)
|
|
||||||
});
|
|
||||||
|
|
||||||
self.offset += *string_length.borrow();
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run user code that returns a struct or union, whose size is provided as an argument
|
/// Run user code that returns a struct or union, whose size is provided as an argument
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
use std::cell::RefCell;
|
|
||||||
|
|
||||||
use roc_module::symbol::Interns;
|
use roc_module::symbol::Interns;
|
||||||
use roc_mono::{
|
use roc_mono::{
|
||||||
ir::ProcLayout,
|
ir::ProcLayout,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue