make the repl app mutable (for expect repl)

This commit is contained in:
Folkert 2022-07-23 13:45:17 +02:00
parent dfbad3c322
commit 6c0217c6f6
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
5 changed files with 58 additions and 49 deletions

View file

@ -11,12 +11,12 @@ pub trait ReplApp<'a> {
/// Run user code that returns a type with a `Builtin` layout
/// Size of the return value is statically determined from its Rust type
/// The `transform` callback takes the app's memory and the returned value
fn call_function<Return, F>(&self, main_fn_name: &str, transform: F) -> Expr<'a>
fn call_function<Return, F>(&mut self, main_fn_name: &str, transform: F) -> Expr<'a>
where
F: Fn(&'a Self::Memory, Return) -> Expr<'a>,
Self::Memory: 'a;
fn call_function_returns_roc_list<F>(&self, main_fn_name: &str, transform: F) -> Expr<'a>
fn call_function_returns_roc_list<F>(&mut self, main_fn_name: &str, transform: F) -> Expr<'a>
where
F: Fn(&'a Self::Memory, (usize, usize, usize)) -> Expr<'a>,
Self::Memory: 'a,
@ -25,7 +25,7 @@ pub trait ReplApp<'a> {
}
fn call_function_returns_roc_str<T, F>(
&self,
&mut self,
target_info: TargetInfo,
main_fn_name: &str,
transform: F,
@ -45,7 +45,7 @@ pub trait ReplApp<'a> {
/// Run user code that returns a struct or union, whose size is provided as an argument
/// The `transform` callback takes the app's memory and the address of the returned value
fn call_function_dynamic_size<T, F>(
&self,
&mut self,
main_fn_name: &str,
ret_bytes: usize,
transform: F,