an attempt to fix the repl tests

This commit is contained in:
Folkert 2022-10-16 15:56:24 +02:00
parent 13fcef3e2c
commit 82ca7fc8c5
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -155,10 +155,32 @@ pub fn add_default_roc_externs(env: &Env<'_, '_, '_>) {
}
}
unreachable_function(env, "roc_getppid");
unreachable_function(env, "roc_mmap");
unreachable_function(env, "roc_send_signal");
unreachable_function(env, "roc_shm_open");
add_sjlj_roc_panic(env)
}
}
fn unreachable_function(env: &Env, name: &str) {
// The type of this function (but not the implementation) should have
// already been defined by the builtins, which rely on it.
let fn_val = env.module.get_function(name).unwrap();
// Add a basic block for the entry point
let entry = env.context.append_basic_block(fn_val, "entry");
env.builder.position_at_end(entry);
env.builder.build_unreachable();
if cfg!(debug_assertions) {
crate::llvm::build::verify_fn(fn_val);
}
}
pub fn add_sjlj_roc_panic(env: &Env<'_, '_, '_>) {
let ctx = env.context;
let module = env.module;