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

@ -135,7 +135,7 @@ impl<'a> ReplApp<'a> for CliApp {
/// Run user code that returns a type with a `Builtin` layout
/// Size of the return value is statically determined from its Rust type
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,
@ -145,7 +145,7 @@ impl<'a> ReplApp<'a> for CliApp {
/// Run user code that returns a struct or union, whose size is provided as an argument
fn call_function_dynamic_size<T, F>(
&self,
&mut self,
main_fn_name: &str,
ret_bytes: usize,
transform: F,
@ -424,11 +424,11 @@ fn gen_and_eval_llvm<'a>(
let (lib, main_fn_name, subs) =
mono_module_to_dylib(&arena, target, loaded, opt_level).expect("we produce a valid Dylib");
let app = CliApp { lib };
let mut app = CliApp { lib };
let res_answer = jit_to_ast(
&arena,
&app,
&mut app,
main_fn_name,
main_fn_layout,
&content,