From cf3284cd8808206f1d67da0581a6eaa88867c050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 2 Jan 2023 20:08:05 +0100 Subject: [PATCH] Interpreter - Handle errors for multiple definitions of an argument --- src/interpreter/functions.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/interpreter/functions.rs b/src/interpreter/functions.rs index 5b0a881..939a971 100644 --- a/src/interpreter/functions.rs +++ b/src/interpreter/functions.rs @@ -47,7 +47,8 @@ impl Callable for Function { assert_eq!(arguments.len(), self.arity()); let param_env = Environment::create_child(environment); for (arg, value) in izip!(self.params.iter(), arguments.into_iter()) { - param_env.borrow_mut().define(&arg, Some(value)); + // FIXME: duplicate parameter names should be detected in the parser + param_env.borrow_mut().define(&arg, Some(value))?; } let child = Environment::create_child(¶m_env);