diff --git a/ablescript/src/interpret.rs b/ablescript/src/interpret.rs index 8aad7ab..0d23481 100644 --- a/ablescript/src/interpret.rs +++ b/ablescript/src/interpret.rs @@ -350,6 +350,15 @@ impl ExecEnv { }) .collect::, Error>>()?; + self.fn_call_with_values(func, &args, span) + } + + fn fn_call_with_values( + &mut self, + func: Functio, + args: &[Rc>], + span: &Range, + ) -> Result<(), Error> { match func { Functio::Bf { instructions, @@ -396,7 +405,16 @@ impl ExecEnv { self.stack.pop(); res?; } - Functio::Chain { .. } => todo!(), + Functio::Chain { functios, kind } => { + let (left_functio, right_functio) = *functios; + let (left_args, right_args) = match kind { + crate::variables::FunctioChainKind::Ordered => args.split_at(args.len() / 2), + crate::variables::FunctioChainKind::Interlaced => todo!(), + }; + + self.fn_call_with_values(left_functio, left_args, span)?; + self.fn_call_with_values(right_functio, right_args, span)?; + } Functio::Eval(code) => { if !args.is_empty() { return Err(Error {