1use super::*;
2
3impl Interpreter {
4 pub fn callable_declared_effects(fn_val: &Value) -> Vec<String> {
5 match fn_val {
6 Value::Fn(function) => function.effects.as_ref().clone(),
7 _ => vec![],
8 }
9 }
10
11 pub fn call_value_pub(
13 &mut self,
14 fn_val: Value,
15 args: Vec<Value>,
16 ) -> Result<Value, RuntimeError> {
17 self.call_value(fn_val, args)
18 }
19
20 pub fn call_value_with_effects_pub(
21 &mut self,
22 fn_val: Value,
23 args: Vec<Value>,
24 entry_name: &str,
25 allowed_effects: Vec<String>,
26 ) -> Result<Value, RuntimeError> {
27 self.call_stack.push(CallFrame {
28 name: Rc::new(entry_name.to_string()),
29 effects: Rc::new(allowed_effects),
30 });
31 let result = self.call_value(fn_val, args);
32 self.call_stack.pop();
33 result
34 }
35}