use OUT_DIR in wasm repl module building

This commit is contained in:
Folkert 2022-07-14 17:58:43 +02:00
parent a75af513c1
commit f0707fd92b
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 12 additions and 5 deletions

View file

@ -155,12 +155,14 @@ impl<'a> ReplApp<'a> for WasmReplApp<'a> {
}
}
const PRE_LINKED_BINARY: &[u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/pre_linked_binary.o")) as &[_];
pub async fn entrypoint_from_js(src: String) -> Result<String, String> {
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
let arena = &Bump::new();
let pre_linked_binary: &'static [u8] = include_bytes!("pre_linked_binary.o");
// Compile the app
let target_info = TargetInfo::default_wasm32();
@ -210,7 +212,7 @@ pub async fn entrypoint_from_js(src: String) -> Result<String, String> {
};
let (mut module, called_preload_fns, main_fn_index) = {
let host_module = roc_gen_wasm::parse_host(env.arena, pre_linked_binary).unwrap();
let host_module = roc_gen_wasm::parse_host(env.arena, PRE_LINKED_BINARY).unwrap();
roc_gen_wasm::build_app_module(
&env,
&mut interns, // NOTE: must drop this mutable ref before jit_to_ast