Fix dev/wasm compile errors

This commit is contained in:
Ayaz Hafiz 2022-08-31 15:42:02 -05:00
parent 3a130acc32
commit cea2fcafae
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 9 additions and 4 deletions

View file

@ -73,6 +73,7 @@ pub fn helper(
procedures,
mut interns,
exposed_to_host,
layout_interner,
..
} = loaded;
@ -176,6 +177,7 @@ pub fn helper(
let env = roc_gen_dev::Env {
arena,
layout_interner: &layout_interner,
module_id,
exposed_to_host: exposed_to_host.values.keys().copied().collect(),
lazy_literals,

View file

@ -18,7 +18,7 @@ use roc_mono::ir::{
Call, CallType, Expr, HostExposedLayouts, Literal, Proc, ProcLayout, SelfRecursive, Stmt,
UpdateModeId,
};
use roc_mono::layout::{Builtin, CapturesNiche, LambdaName, Layout};
use roc_mono::layout::{Builtin, CapturesNiche, LambdaName, Layout, STLayoutInterner};
use wasm3::{Environment, Module};
const LINKING_TEST_HOST_WASM: &str = "build/wasm_linking_test_host.wasm";
@ -141,7 +141,7 @@ struct BackendInputs<'a> {
}
impl<'a> BackendInputs<'a> {
fn new(arena: &'a Bump) -> Self {
fn new(arena: &'a Bump, layout_interner: &'a STLayoutInterner<'a>) -> Self {
// Compile the host from an external source file
let host_bytes = fs::read(LINKING_TEST_HOST_WASM).unwrap();
let host_module: WasmModule = roc_gen_wasm::parse_host(arena, &host_bytes).unwrap();
@ -159,6 +159,7 @@ impl<'a> BackendInputs<'a> {
exposed_to_host.insert(roc_main_sym);
let env = Env {
arena,
layout_interner,
module_id,
exposed_to_host,
stack_bytes: Env::DEFAULT_STACK_BYTES,
@ -226,13 +227,14 @@ fn get_native_result() -> i32 {
#[test]
fn test_linking_without_dce() {
let arena = Bump::new();
let layout_interner = STLayoutInterner::with_capacity(4);
let BackendInputs {
env,
mut interns,
host_module,
procedures,
} = BackendInputs::new(&arena);
} = BackendInputs::new(&arena, &layout_interner);
let host_import_names = Vec::from_iter(host_module.import.imports.iter().map(|i| i.name));
assert_eq!(
@ -280,13 +282,14 @@ fn test_linking_without_dce() {
#[test]
fn test_linking_with_dce() {
let arena = Bump::new();
let layout_interner = STLayoutInterner::with_capacity(4);
let BackendInputs {
env,
mut interns,
host_module,
procedures,
} = BackendInputs::new(&arena);
} = BackendInputs::new(&arena, &layout_interner);
let host_import_names = Vec::from_iter(host_module.import.imports.iter().map(|imp| imp.name));
assert_eq!(