mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
wasm: get rid of Result from gen_wasm, rename a function, improve comments
This commit is contained in:
parent
2fd2a85887
commit
85b418ebdf
3 changed files with 8 additions and 9 deletions
|
@ -47,25 +47,25 @@ pub struct Env<'a> {
|
|||
pub exposed_to_host: MutSet<Symbol>,
|
||||
}
|
||||
|
||||
/// Entry point for production
|
||||
/// Entry point for Roc CLI
|
||||
pub fn build_module<'a>(
|
||||
env: &'a Env<'a>,
|
||||
interns: &'a mut Interns,
|
||||
preload_bytes: &[u8],
|
||||
procedures: MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>,
|
||||
) -> Result<std::vec::Vec<u8>, String> {
|
||||
) -> std::vec::Vec<u8> {
|
||||
let (mut wasm_module, called_preload_fns, _) =
|
||||
build_module_without_test_wrapper(env, interns, preload_bytes, procedures);
|
||||
build_module_without_wrapper(env, interns, preload_bytes, procedures);
|
||||
|
||||
wasm_module.remove_dead_preloads(env.arena, called_preload_fns);
|
||||
|
||||
let mut buffer = std::vec::Vec::with_capacity(wasm_module.size());
|
||||
wasm_module.serialize(&mut buffer);
|
||||
Ok(buffer)
|
||||
buffer
|
||||
}
|
||||
|
||||
/// Entry point for integration tests (test_gen)
|
||||
pub fn build_module_without_test_wrapper<'a>(
|
||||
/// Entry point for REPL (repl_wasm) and integration tests (test_gen)
|
||||
pub fn build_module_without_wrapper<'a>(
|
||||
env: &'a Env<'a>,
|
||||
interns: &'a mut Interns,
|
||||
preload_bytes: &[u8],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue