From 4b8392696e51eac87cbb18c0307345ab8cd27cbb Mon Sep 17 00:00:00 2001 From: Folkert Date: Fri, 6 Nov 2020 23:15:27 +0100 Subject: [PATCH] make effect name flexible --- compiler/load/src/file.rs | 5 ++++- examples/effect/platform/src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/load/src/file.rs b/compiler/load/src/file.rs index 5fccf6ecaf..16b5888484 100644 --- a/compiler/load/src/file.rs +++ b/compiler/load/src/file.rs @@ -2288,6 +2288,7 @@ fn fabricate_host_exposed_def<'a>( scope: &mut roc_can::scope::Scope, module_id: ModuleId, symbol: Symbol, + ident: &str, effect_tag_name: TagName, var_store: &mut VarStore, annotation: roc_can::annotation::Annotation, @@ -2334,8 +2335,9 @@ fn fabricate_host_exposed_def<'a>( } // TODO figure out something better for run lowlevel + let foreign_symbol_name = format!("roc_fx_{}", ident); let low_level_call = Expr::ForeignCall { - foreign_symbol: "roc_fx_put_char".into(), + foreign_symbol: foreign_symbol_name.into(), args: linked_symbol_arguments, ret_var: var_store.fresh(), }; @@ -2622,6 +2624,7 @@ fn fabricate_effects_module<'a>( &mut scope, module_id, symbol, + ident.value, TagName::Private(effect_symbol), &mut var_store, annotation, diff --git a/examples/effect/platform/src/lib.rs b/examples/effect/platform/src/lib.rs index b4afbf4c16..30daf31e9e 100644 --- a/examples/effect/platform/src/lib.rs +++ b/examples/effect/platform/src/lib.rs @@ -18,7 +18,7 @@ extern "C" { } #[no_mangle] -pub fn roc_fx_put_char(foo: i64) -> () { +pub fn roc_fx_putChar(foo: i64) -> () { let character = foo as u8 as char; print!("{}", character);