diff --git a/ablescript/src/error.rs b/ablescript/src/error.rs index d78aa252..051a3254 100644 --- a/ablescript/src/error.rs +++ b/ablescript/src/error.rs @@ -14,7 +14,6 @@ pub enum ErrorKind { UnknownVariable(String), MeloVariable(String), TopLevelBreak, - MismatchedArity, MissingLhs, Brian(InterpretError), Io(io::Error), @@ -54,7 +53,6 @@ impl Display for ErrorKind { ErrorKind::TopLevelBreak => write!(f, "can only `break` out of a loop"), ErrorKind::Brian(err) => write!(f, "brainfuck error: {}", err), // TODO: give concrete numbers here. - ErrorKind::MismatchedArity => write!(f, "wrong number of function arguments"), ErrorKind::MissingLhs => write!(f, "missing expression before binary operation"), ErrorKind::Io(err) => write!(f, "I/O error: {}", err), } diff --git a/ablescript/src/interpret.rs b/ablescript/src/interpret.rs index 7cdd7a49..5b0ff371 100644 --- a/ablescript/src/interpret.rs +++ b/ablescript/src/interpret.rs @@ -437,13 +437,6 @@ impl ExecEnv { .expect("Failed to write to stdout"); } Functio::Able { params, body } => { - if params.len() != args.len() { - return Err(Error { - kind: ErrorKind::MismatchedArity, - span: span.to_owned(), - }); - } - self.stack.push(Default::default()); for (param, arg) in params.iter().zip(args.iter()) { @@ -474,17 +467,7 @@ impl ExecEnv { } }; } - Functio::Eval(code) => { - if !args.is_empty() { - return Err(Error { - kind: ErrorKind::MismatchedArity, - span: span.to_owned(), - }); - } - - let stmts = crate::parser::parse(&code)?; - self.eval_stmts(&stmts)?; - } + Functio::Eval(code) => self.eval_stmts(&crate::parser::parse(&code)?)?, } Ok(()) }