List.get with negative index in repl

This commit is contained in:
Folkert 2024-01-28 22:19:30 +01:00
parent 917e0e2027
commit b0d57587e3
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
8 changed files with 109 additions and 33 deletions

View file

@ -25,12 +25,13 @@ pub trait ReplApp<'a> {
self.call_function(main_fn_name, transform)
}
/// When the executed code calls roc_panic, this function will return None
fn call_function_returns_roc_str<T, F>(
&mut self,
target_info: TargetInfo,
main_fn_name: &str,
transform: F,
) -> T
) -> Option<T>
where
F: Fn(&'a Self::Memory, usize) -> T,
Self::Memory: 'a,
@ -45,12 +46,14 @@ 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
///
/// When the executed code calls roc_panic, this function will return None
fn call_function_dynamic_size<T, F>(
&mut self,
main_fn_name: &str,
ret_bytes: usize,
transform: F,
) -> T
) -> Option<T>
where
F: FnMut(&'a Self::Memory, usize) -> T,
Self::Memory: 'a;