mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Fix dev/wasm compile errors
This commit is contained in:
parent
3a130acc32
commit
cea2fcafae
2 changed files with 9 additions and 4 deletions
|
@ -73,6 +73,7 @@ pub fn helper(
|
||||||
procedures,
|
procedures,
|
||||||
mut interns,
|
mut interns,
|
||||||
exposed_to_host,
|
exposed_to_host,
|
||||||
|
layout_interner,
|
||||||
..
|
..
|
||||||
} = loaded;
|
} = loaded;
|
||||||
|
|
||||||
|
@ -176,6 +177,7 @@ pub fn helper(
|
||||||
|
|
||||||
let env = roc_gen_dev::Env {
|
let env = roc_gen_dev::Env {
|
||||||
arena,
|
arena,
|
||||||
|
layout_interner: &layout_interner,
|
||||||
module_id,
|
module_id,
|
||||||
exposed_to_host: exposed_to_host.values.keys().copied().collect(),
|
exposed_to_host: exposed_to_host.values.keys().copied().collect(),
|
||||||
lazy_literals,
|
lazy_literals,
|
||||||
|
|
|
@ -18,7 +18,7 @@ use roc_mono::ir::{
|
||||||
Call, CallType, Expr, HostExposedLayouts, Literal, Proc, ProcLayout, SelfRecursive, Stmt,
|
Call, CallType, Expr, HostExposedLayouts, Literal, Proc, ProcLayout, SelfRecursive, Stmt,
|
||||||
UpdateModeId,
|
UpdateModeId,
|
||||||
};
|
};
|
||||||
use roc_mono::layout::{Builtin, CapturesNiche, LambdaName, Layout};
|
use roc_mono::layout::{Builtin, CapturesNiche, LambdaName, Layout, STLayoutInterner};
|
||||||
use wasm3::{Environment, Module};
|
use wasm3::{Environment, Module};
|
||||||
|
|
||||||
const LINKING_TEST_HOST_WASM: &str = "build/wasm_linking_test_host.wasm";
|
const LINKING_TEST_HOST_WASM: &str = "build/wasm_linking_test_host.wasm";
|
||||||
|
@ -141,7 +141,7 @@ struct BackendInputs<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> 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
|
// Compile the host from an external source file
|
||||||
let host_bytes = fs::read(LINKING_TEST_HOST_WASM).unwrap();
|
let host_bytes = fs::read(LINKING_TEST_HOST_WASM).unwrap();
|
||||||
let host_module: WasmModule = roc_gen_wasm::parse_host(arena, &host_bytes).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);
|
exposed_to_host.insert(roc_main_sym);
|
||||||
let env = Env {
|
let env = Env {
|
||||||
arena,
|
arena,
|
||||||
|
layout_interner,
|
||||||
module_id,
|
module_id,
|
||||||
exposed_to_host,
|
exposed_to_host,
|
||||||
stack_bytes: Env::DEFAULT_STACK_BYTES,
|
stack_bytes: Env::DEFAULT_STACK_BYTES,
|
||||||
|
@ -226,13 +227,14 @@ fn get_native_result() -> i32 {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_linking_without_dce() {
|
fn test_linking_without_dce() {
|
||||||
let arena = Bump::new();
|
let arena = Bump::new();
|
||||||
|
let layout_interner = STLayoutInterner::with_capacity(4);
|
||||||
|
|
||||||
let BackendInputs {
|
let BackendInputs {
|
||||||
env,
|
env,
|
||||||
mut interns,
|
mut interns,
|
||||||
host_module,
|
host_module,
|
||||||
procedures,
|
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));
|
let host_import_names = Vec::from_iter(host_module.import.imports.iter().map(|i| i.name));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -280,13 +282,14 @@ fn test_linking_without_dce() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_linking_with_dce() {
|
fn test_linking_with_dce() {
|
||||||
let arena = Bump::new();
|
let arena = Bump::new();
|
||||||
|
let layout_interner = STLayoutInterner::with_capacity(4);
|
||||||
|
|
||||||
let BackendInputs {
|
let BackendInputs {
|
||||||
env,
|
env,
|
||||||
mut interns,
|
mut interns,
|
||||||
host_module,
|
host_module,
|
||||||
procedures,
|
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));
|
let host_import_names = Vec::from_iter(host_module.import.imports.iter().map(|imp| imp.name));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue