mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
wasm: Implement Str.split
This commit is contained in:
parent
d2dbb0001a
commit
02ec30425c
7 changed files with 267 additions and 259 deletions
|
@ -184,7 +184,8 @@ pub fn build_app_module<'a>(
|
|||
}
|
||||
|
||||
let (module, called_preload_fns) = backend.finalize();
|
||||
let main_function_index = maybe_main_fn_index.unwrap();
|
||||
let main_function_index =
|
||||
maybe_main_fn_index.expect("The app must expose at least one value to the host");
|
||||
|
||||
(module, called_preload_fns, main_function_index)
|
||||
}
|
||||
|
|
|
@ -235,15 +235,7 @@ impl<'a> LowLevelCall<'a> {
|
|||
self.load_args_and_call_zig(backend, bitcode::STR_STARTS_WITH_SCALAR)
|
||||
}
|
||||
StrEndsWith => self.load_args_and_call_zig(backend, bitcode::STR_ENDS_WITH),
|
||||
StrSplit => {
|
||||
// LLVM implementation (build_str.rs) does the following
|
||||
// 1. Call bitcode::STR_COUNT_SEGMENTS
|
||||
// 2. Allocate a `List Str`
|
||||
// 3. Call bitcode::STR_STR_SPLIT_IN_PLACE
|
||||
// 4. Write the elements and length of the List
|
||||
// To do this here, we need full access to WasmBackend, or we could make a Zig wrapper
|
||||
todo!("{:?}", self.lowlevel);
|
||||
}
|
||||
StrSplit => self.load_args_and_call_zig(backend, bitcode::STR_STR_SPLIT),
|
||||
StrCountGraphemes => {
|
||||
self.load_args_and_call_zig(backend, bitcode::STR_COUNT_GRAPEHEME_CLUSTERS)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue