clean up expect code when not running tests

This commit is contained in:
Folkert 2022-07-27 12:26:03 +02:00
parent 91ea71c7aa
commit 498004c554
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 11 additions and 4 deletions

View file

@ -21,12 +21,14 @@ pub fn add_default_roc_externs(env: &Env<'_, '_, '_>) {
match env.mode {
super::build::LlvmBackendMode::CliTest => {
/* linkage is strong, which means this function is exposed */
// expose this function
let fn_val = module.get_function("set_mmapped_file").unwrap();
fn_val.set_linkage(Linkage::External);
}
_ => {
// set linkage to private, so it is DCE'd
// remove this function from the module
let fn_val = module.get_function("set_mmapped_file").unwrap();
fn_val.set_linkage(Linkage::Private);
unsafe { fn_val.delete() };
}
}